我尝试使用基本模板enter link description here将ng2-bootstrap与webpack集成。但是我似乎无法使ng2-bootstrap集成成功。
以下是我的网络包配置
"use strict";
var webpack = require('webpack');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
'app': './app/main.ts',
'vendors': './app/vendors.ts',
'polyfills': './app/polyfills.ts'
},
output: {
path: './wwwroot',
filename: '[name].bundle.js',
sourceMapFilename: '[name].bundle.map',
chunkFilename: '[id].chunk.js',
publicPath: '/'
},
devtool: 'source-map',
resolve: {
extensions: ['', '.ts', '.js', '.json', '.css', '.scss', '.html']
},
module: {
loaders: [
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader', 'angular2-router-loader']
},
{
test: /\.(html|css)$/,
loader: 'raw-loader',
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({ name: ['vendors', 'polyfills'] }),
new CleanWebpackPlugin(
[
'./wwwroot/'
]
),
new HtmlWebpackPlugin({
filename: './index.html',
template: './index.html',
inject: 'body'
})
],
devServer: {
contentBase: ".",
host: "localhost",
port: 9000
}
};
以下是我的导入,
import { DropdownModule } from 'ng2-bootstrap/dropdown';
import { TabsModule } from 'ng2-bootstrap/tabs';
由于某些奇怪的原因,ng2-bootstrap代码似乎没有通过浏览器。
希望你能快速解决这个问题。