const path = require('path') const webpack = require('webpack') module.exports = { entry: { index: [ './examples/index.js', ], }, output: { path: path.resolve(__dirname, './dist'), publicPath: '/dist/', filename: 'build.js', }, module: { rules: [ { test: /\.vue$/, loader: 'vue-loader', }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/, }, { test: /\.(png|jpg|gif|svg)$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]', }, }, { test: /\.less$/, use: [ { loader: 'style-loader' }, { loader: 'css-loader', options: { sourceMap: true }, }, { loader: 'less-loader', options: { sourceMap: true }, }, ], }, ], }, resolve: { extensions: ['.js', '.vue'], alias: { 'vue$': 'vue/dist/vue.esm.js', 'antd': path.join(__dirname, 'components'), }, }, devServer: { port: 3000, inline: true, historyApiFallback: { index: 'examples/index.html', }, disableHostCheck: true, headers: { 'Access-Control-Allow-Origin': '*' }, }, performance: { hints: false, }, devtool: '#source-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, }), ]) }