You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.5 KiB
62 lines
1.5 KiB
1 year ago
|
/**
|
||
|
* platform-core 库构建
|
||
|
*/
|
||
|
const path = require('path'); // path
|
||
|
const { merge } = require('webpack-merge'); // webpack 配置合并函数
|
||
|
const common = require('./webpack.config.common.cjs'); // webpack 通用配置
|
||
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 抽取 css 插件
|
||
|
|
||
|
const config =merge(common, {
|
||
|
mode: 'production',
|
||
|
entry: {
|
||
|
'platform-components':'./src/platform/index.ts',
|
||
|
},
|
||
|
devtool: 'source-map',
|
||
|
output: {
|
||
|
path: path.resolve(__dirname, 'dist'),
|
||
|
filename: '[name].js',
|
||
|
library: {
|
||
|
name: {
|
||
|
root: '[name]',
|
||
|
amd: '[name]',
|
||
|
commonjs: '[name]',
|
||
|
},
|
||
|
type: 'umd',
|
||
|
},
|
||
|
clean: true,
|
||
|
},
|
||
|
|
||
|
// 外部化第三方库, 仅打包 platform-core 库
|
||
|
externals: [
|
||
|
{
|
||
|
'@quasar/extras':'@quasar/extras',
|
||
|
'axios':'axios',
|
||
|
'dayjs':'dayjs',
|
||
|
'mockjs':'mockjs',
|
||
|
'pinia':'pinia',
|
||
|
'quasar':'quasar',
|
||
|
'tailwindcss':'tailwindcss',
|
||
|
'vue':'vue',
|
||
|
'vue-i18n':'vue-i18n',
|
||
|
'vue-router':'vue-router',
|
||
|
}
|
||
|
],
|
||
|
|
||
|
optimization: {
|
||
|
minimize: false,
|
||
|
moduleIds: 'named',
|
||
|
chunkIds: 'named',
|
||
|
},
|
||
|
});
|
||
|
|
||
|
// 修改 css 输出路径和名称
|
||
|
for (let i = 0; i < config.plugins.length; i++) {
|
||
|
const plugin = config.plugins[i];
|
||
|
if (plugin instanceof MiniCssExtractPlugin) {
|
||
|
plugin.options.filename =`css/[name].css`;
|
||
|
plugin.options.chunkFilename =`css/[name].css`;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = config;
|