UNPKG

vue-questionnaire-create

Version:

管理端问卷创建组件(vue)

91 lines (87 loc) 1.85 kB
var path = require('path') var webpack = require('webpack') const $pkg = require('./package.json'); const NODE_ENV = process.env.NODE_ENV module.exports = { entry: NODE_ENV === 'development' ? './src/main.js' : './index.js', output: { path: path.resolve(__dirname, './dist'), filename: `${$pkg.name}.js`, publicPath: '/dist/', library: $pkg.name, libraryTarget: 'umd', umdNamedDefine: true }, // 剔除掉一些通用包,自己的包不打包这些类库,需要用户环境来提供 externals: { vue: 'vue', 'element-ui': 'element-ui', axios: 'axios' }, module: { rules: [ { test: /\.css$/, use: ['vue-style-loader', 'css-loader'] }, { test: /\.vue$/, loader: 'vue-loader', options: { loaders: {} // other vue-loader options go here } }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /\.(png|jpg|gif|svg|ttf|woff)$/, loader: 'file-loader', options: { limit: 50000000, name: '[name].[ext]?[hash]' } } ] }, resolve: { alias: { vue$: 'vue/dist/vue.esm.js' }, extensions: ['*', '.js', '.vue', '.json'] }, devServer: { historyApiFallback: true, noInfo: true, overlay: true }, performance: { hints: false } } // 设置生产环境不生成map文件 if (process.env.NODE_ENV === 'production') { // module.exports.devtool = '#source-map' // http://vue-loader.vuejs.org/en/workflow/production.html module.exports.plugins = (module.exports.plugins || []).concat([ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }), new webpack.optimize.UglifyJsPlugin({ sourceMap: true, compress: { warnings: false } }), new webpack.LoaderOptionsPlugin({ minimize: true }) ]) } else { module.exports.devtool = '#eval-source-map' }