1234567891011121314151617181920212223242526272829303132333435363738 |
- const { defineConfig } = require("@vue/cli-service");
- const path = require('path');
- const config = require('./config');
- const IS_PRODUCTION = process.env.NODE_ENV === 'production';
- // 当前博物馆
- const MUSEUM = process.env.MUSEUM;
- if (MUSEUM != null) {
- console.log('当前博物馆:', MUSEUM);
- }
- module.exports = defineConfig({
- transpileDependencies: true,
- lintOnSave: false,
- publicPath: IS_PRODUCTION ? config.publicPath : '/',
- outputDir: (IS_PRODUCTION && !!MUSEUM) ? `build/${MUSEUM}` : 'build',
- // 根据博物馆隔离
- assetsDir: path.posix.join(config.assetsDir, MUSEUM || ''),
- configureWebpack: {
- resolve: {
- symlinks: false,
- alias: {
- '@': path.join(__dirname, 'src'),
- },
- },
- },
- chainWebpack: (webpackConfig) => {
- if (MUSEUM != null) {
- const extensions = webpackConfig.resolve.extensions.values();
- for (let i = extensions.length - 1; i >= 0; i--) {
- webpackConfig.resolve.extensions.prepend(`.${MUSEUM}${extensions[i]}`);
- }
- }
- }
- });
|