mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-02 04:08:10 +08:00
5f346f04de
Webpack UMD modules are broken currently: [webpack/webpack#6525](https://github.com/webpack/webpack/issues/6525)
88 lines
1.9 KiB
JavaScript
88 lines
1.9 KiB
JavaScript
const path = require('path');
|
|
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
|
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
|
|
const config = require('./config');
|
|
|
|
module.exports = {
|
|
mode: 'production',
|
|
entry: {
|
|
app: ['./src/index.js']
|
|
},
|
|
output: {
|
|
path: path.resolve(process.cwd(), './lib'),
|
|
publicPath: '/dist/',
|
|
filename: 'index.js',
|
|
chunkFilename: '[id].js',
|
|
libraryTarget: 'umd',
|
|
libraryExport: 'default',
|
|
library: 'ELEMENT',
|
|
umdNamedDefine: true,
|
|
globalObject: 'typeof self !== \'undefined\' ? self : this'
|
|
},
|
|
resolve: {
|
|
extensions: ['.js', '.vue', '.json'],
|
|
alias: config.alias
|
|
},
|
|
externals: {
|
|
vue: config.vue
|
|
},
|
|
optimization: {
|
|
minimizer: [
|
|
new TerserPlugin({
|
|
terserOptions: {
|
|
output: {
|
|
comments: false
|
|
}
|
|
},
|
|
})
|
|
]
|
|
},
|
|
performance: {
|
|
hints: false
|
|
},
|
|
stats: {
|
|
children: false
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(jsx?|babel|es6)$/,
|
|
include: process.cwd(),
|
|
exclude: config.jsexclude,
|
|
loader: 'babel-loader'
|
|
},
|
|
{
|
|
test: /\.vue$/,
|
|
loader: 'vue-loader',
|
|
options: {
|
|
compilerOptions: {
|
|
preserveWhitespace: false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
loaders: ['style-loader', 'css-loader', 'postcss-loader']
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
loaders: ['style-loader', 'css-loader', 'sass-loader']
|
|
},
|
|
{
|
|
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
|
|
loader: 'url-loader',
|
|
query: {
|
|
limit: 10000,
|
|
name: path.posix.join('static', '[name].[hash:7].[ext]')
|
|
}
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new ProgressBarPlugin(),
|
|
new VueLoaderPlugin()
|
|
]
|
|
};
|