element-plus/build/webpack.config.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-09-15 16:10:32 +08:00
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
2020-09-15 16:10:32 +08:00
module.exports = {
mode: 'development',
2020-09-15 17:12:16 +08:00
entry: path.resolve(__dirname, '../packages/element-plus/index.ts'),
2020-09-15 16:10:32 +08:00
output: {
path: path.resolve(__dirname, '../lib'),
publicPath: '/',
2020-09-15 17:12:16 +08:00
filename: 'index.js',
libraryTarget: 'umd',
libraryExport: 'default',
2020-10-16 14:33:43 +08:00
library: 'ElementPlus',
2020-09-15 17:12:16 +08:00
umdNamedDefine: true,
globalObject: 'typeof self !== \'undefined\' ? self : this',
2020-09-15 16:10:32 +08:00
},
stats: 'verbose',
module: {
rules: [
{
test: /\.vue$/,
use: 'vue-loader',
},
{
test: /\.(ts|js)x?$/,
2020-09-15 16:10:32 +08:00
exclude: /node_modules/,
loader: 'babel-loader',
2020-09-15 16:10:32 +08:00
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
2020-09-15 16:10:32 +08:00
},
externals: {
2020-10-16 14:14:36 +08:00
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue',
},
2020-09-15 16:10:32 +08:00
},
plugins: [
new VueLoaderPlugin(),
// new BundleAnalyzerPlugin(),
2020-09-15 16:10:32 +08:00
],
}