var path = require('path'); var webpack = require('webpack'); module.exports = { entry: { main: './src/index.js' }, output: { path: path.resolve(__dirname, '../dist'), publicPath: '/dist/', filename: 'iview.min.js', library: 'iview', libraryTarget: 'umd', umdNamedDefine: true }, externals: { vue: { root: 'Vue', commonjs: 'vue', commonjs2: 'vue', amd: 'vue' } }, resolve: { extensions: ['.js', '.vue'] }, module: { rules: [ { test: /\.vue$/, loader: 'vue-loader', options: { postLoaders: { html: 'babel-loader' } } }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ } ] }, plugins: [ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }) ] }