2018-05-21 15:26:46 +08:00
|
|
|
const path = require('path');
|
|
|
|
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
2019-01-23 11:34:19 +08:00
|
|
|
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
2018-05-21 15:26:46 +08:00
|
|
|
|
|
|
|
const config = require('./config');
|
|
|
|
|
|
|
|
module.exports = {
|
2019-01-23 11:34:19 +08:00
|
|
|
mode: 'production',
|
2018-05-21 15:26:46 +08:00
|
|
|
entry: {
|
|
|
|
app: ['./src/index.js']
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.resolve(process.cwd(), './lib'),
|
|
|
|
publicPath: '/dist/',
|
|
|
|
filename: 'element-ui.common.js',
|
|
|
|
chunkFilename: '[id].js',
|
2019-01-26 14:31:41 +08:00
|
|
|
libraryExport: 'default',
|
|
|
|
library: 'ELEMENT',
|
2018-05-21 15:26:46 +08:00
|
|
|
libraryTarget: 'commonjs2'
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.vue', '.json'],
|
|
|
|
alias: config.alias,
|
|
|
|
modules: ['node_modules']
|
|
|
|
},
|
|
|
|
externals: config.externals,
|
2019-01-23 11:34:19 +08:00
|
|
|
performance: {
|
|
|
|
hints: false
|
|
|
|
},
|
|
|
|
stats: {
|
|
|
|
children: false
|
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
minimize: false
|
|
|
|
},
|
2018-05-21 15:26:46 +08:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.(jsx?|babel|es6)$/,
|
|
|
|
include: process.cwd(),
|
|
|
|
exclude: config.jsexclude,
|
|
|
|
loader: 'babel-loader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: 'vue-loader',
|
|
|
|
options: {
|
2019-01-23 11:34:19 +08:00
|
|
|
compilerOptions: {
|
|
|
|
preserveWhitespace: false
|
|
|
|
}
|
2018-05-21 15:26:46 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2019-02-26 16:23:26 +08:00
|
|
|
loaders: ['style-loader', 'css-loader']
|
2018-05-21 15:26:46 +08:00
|
|
|
},
|
|
|
|
{
|
2019-01-23 11:34:19 +08:00
|
|
|
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
|
2018-05-21 15:26:46 +08:00
|
|
|
loader: 'url-loader',
|
|
|
|
query: {
|
|
|
|
limit: 10000,
|
|
|
|
name: path.posix.join('static', '[name].[hash:7].[ext]')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new ProgressBarPlugin(),
|
2019-01-23 11:34:19 +08:00
|
|
|
new VueLoaderPlugin()
|
2018-05-21 15:26:46 +08:00
|
|
|
]
|
|
|
|
};
|