var path = require('path') var webpack = require('webpack') var HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = { entry: { vendor: [ 'babel-polyfill', 'js-cookie', 'moment', 'q', 'axios', 'vue/dist/vue.common.js', 'vue-i18n', 'vue-router', 'vuex' ] }, output: { path: path.resolve(__dirname, '../static/js'), filename: '[name].dll.js', library: '[name]_library' }, module: { rules: [ { test: /\.vue$/, loader: 'vue-loader' }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ } ] }, plugins: [ new webpack.optimize.ModuleConcatenationPlugin(), new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /zh-cn|en-gb/), new webpack.DllPlugin({ path: path.join(__dirname, '.', '[name]-manifest.json'), libraryTarget: 'commonjs2', name: '[name]_library' }), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }) ] }