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.
80 lines
2.4 KiB
80 lines
2.4 KiB
/**
|
|
* 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-core':'./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: [
|
|
{
|
|
'@codemirror/autocomplete': '@codemirror/autocomplete',
|
|
'@codemirror/commands': '@codemirror/commands',
|
|
'@codemirror/lang-html': '@codemirror/lang-html',
|
|
'@codemirror/lang-java': '@codemirror/lang-java',
|
|
'@codemirror/lang-javascript': '@codemirror/lang-javascript',
|
|
'@codemirror/lang-json': '@codemirror/lang-json',
|
|
'@codemirror/lang-sql': '@codemirror/lang-sql',
|
|
'@codemirror/lang-xml': '@codemirror/lang-xml',
|
|
'@codemirror/language': '@codemirror/language',
|
|
'@codemirror/search': '@codemirror/search',
|
|
'@codemirror/state': '@codemirror/state',
|
|
'@codemirror/view': '@codemirror/view',
|
|
'@quasar/extras': '@quasar/extras',
|
|
'@vueuse/core': '@vueuse/core',
|
|
'axios': 'axios',
|
|
'codemirror': 'codemirror',
|
|
'dayjs': 'dayjs',
|
|
'echarts': 'echarts',
|
|
'exceljs': 'exceljs',
|
|
'file-saver': 'file-saver',
|
|
'luckyexcel': 'luckyexcel',
|
|
'mockjs': 'mockjs',
|
|
'pinia': 'pinia',
|
|
'quasar': 'quasar',
|
|
'tailwindcss': 'tailwindcss',
|
|
'vue': 'vue',
|
|
'vue-dompurify-html': 'vue-dompurify-html',
|
|
'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;
|
|
|