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 babelOptions = {
|
|
|
|
plugins: ['@vue/babel-plugin-jsx'],
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: 'production',
|
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',
|
|
|
|
library: 'ELEMENT',
|
|
|
|
umdNamedDefine: true,
|
2020-09-15 16:10:32 +08:00
|
|
|
},
|
|
|
|
stats: 'verbose',
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
use: 'vue-loader',
|
|
|
|
},
|
|
|
|
{ // todo remote
|
|
|
|
test: /\.(sass|scss|css)$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
'css-loader',
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
implementation: require('sass'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.ts$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: 'ts-loader',
|
|
|
|
options: {
|
|
|
|
appendTsSuffixTo: [/\.vue$/],
|
|
|
|
transpileOnly: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.tsx$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: babelOptions,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'ts-loader',
|
|
|
|
options: {
|
|
|
|
appendTsxSuffixTo: [/\.vue$/],
|
|
|
|
transpileOnly: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js(x?)$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: babelOptions,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.tsx', '.js', '.vue', '.json'],
|
|
|
|
},
|
|
|
|
externals: {
|
2020-09-15 17:12:16 +08:00
|
|
|
vue: 'vue',
|
2020-09-15 16:10:32 +08:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new VueLoaderPlugin(),
|
|
|
|
],
|
|
|
|
}
|