@wocwin/t-ui
Version:
Vue 中基于Element-ui二次封装基础组件文档
82 lines (80 loc) • 1.83 kB
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')
module.exports = {
mode: 'production',
entry: {
app: ['./packages/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: {
packages: path.resolve(__dirname, './packages'),
examples: path.resolve(__dirname, './examples')
}
},
externals: {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: '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: /node_modules|utils\/popper\.js|utils\/date\.js/,
loader: 'babel-loader'
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false
}
}
},
{
test: /\.(scss|css)$/,
loaders: ['style-loader', 'css-loader', 'sass-loader']
}
]
},
plugins: [
new ProgressBarPlugin(),
new VueLoaderPlugin()
]
}