You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
1.8 KiB
89 lines
1.8 KiB
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: '#eval-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,
|
|
}),
|
|
])
|
|
}
|