我正在尝试使用基本模板enter link description here将ng2-bootstrap与webpack集成。然而,我似乎无法使ng2-bootstrap集成成功。
下面是我的web包配置,
"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代码似乎不能被浏览器理解。
希望你能为我提供一个快速解决这个问题的方法。
发布于 2017-02-09 21:00:33
你可以像我这样处理,就好了
https://stackoverflow.com/questions/41937384
复制相似问题