mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-21 02:50:11 +08:00
59234e58c4
omitting vue extension is bad practice
94 lines
1.9 KiB
JavaScript
94 lines
1.9 KiB
JavaScript
/* 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',
|
|
entry: path.resolve(__dirname, '../packages/element-plus/index.ts'),
|
|
output: {
|
|
path: path.resolve(__dirname, '../lib'),
|
|
publicPath: '/',
|
|
filename: 'index.js',
|
|
libraryTarget: 'umd',
|
|
libraryExport: 'default',
|
|
library: 'ElementPlus',
|
|
umdNamedDefine: true,
|
|
},
|
|
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', '.json'],
|
|
},
|
|
externals: {
|
|
vue: {
|
|
root: 'Vue',
|
|
commonjs: 'vue',
|
|
commonjs2: 'vue',
|
|
amd: 'vue',
|
|
},
|
|
},
|
|
plugins: [
|
|
new VueLoaderPlugin(),
|
|
],
|
|
}
|