我正在使用 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" ] } };