我使用的是ionic2 + angular2。我想把我自己的代码放在一个文件中,然后把所有的库合并到另一个文件中。
问题是,我自己的应用程序仍然包含这些库。
这是我的配置文件:
var path = require('path'); var webpack = require("webpack");
module.exports = { root: path.resolve('/'),
devtool: 'source-map',
entry: {
vendor:[path.normalize('es6-shim/es6-shim.min'),
'reflect-metadata',
'web-animations.min',
'zone.js/dist/zone-microtask',
'ionic-framework/ionic'
],
app: path.resolve('www/app/app.ts')
},
output: {
filename: '[name].js',
},
plugin:[
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename:
'vendor.js', minChunks: Infinity }),
],
module: {
loaders: [
{
test: /\.ts$/,
loader: 'awesome-typescript',
query: {
'doTypeCheck': false
},
include: path.resolve('www/app'),
exclude: /node_modules/
},
{
test: /\.js$/,
include: path.resolve('node_modules/angular2'),
loader: 'strip-sourcemap'
},
{ test: /\.html$/, loader: 'raw-loader' },
],
noParse: [
/es6-shim/,
/reflect-metadata/,
/web-animations/,
/zone\.js(\/|\\)dist(\/|\\)zone-microtask/
] }, resolve: {
alias: {
'web-animations.min': path.normalize('ionic-framework/js/web-animations.min')
},
extensions: ["", ".ts", ".js" ] } };发布于 2016-01-04 01:29:31
我想您忘了为vendor entry指定angular2和ionic2模块:
entry: {
vendor:[
path.normalize('es6-shim/es6-shim.min'),
'reflect-metadata',
'web-animations.min',
'zone.js/dist/zone-microtask',
'ionic-framework/ionic',
// HERE: add all "angular2" and "ionic2" modules you're using
'angular2/platform/browser',
'angular2/core',
'angular2/router',
// and so on...
],
// ...
}https://stackoverflow.com/questions/34578033
复制相似问题