代码拉取完成,页面将自动刷新
const path = require('path');
const resolve = filePath => path.resolve(__dirname, './', filePath);
const { DefinePlugin } = require('webpack');
const globalComponentPrefix = 'custom';
// process.env.NODE_ENV = 'production'
const config = {
title: 'PLAIN DESIGN', // 单页面应用title
APP_NAME: 'PLAIN_DESIGN_APPLICATION', // 每个应用的唯一标识,没有格式限制,只能用下划线命名,因为最后会输出为一个变量名
publicPath: '/plain-design/', // 部署路径
};
module.exports = {
publicPath: config.publicPath,
devServer: {
port: '3379',
},
lintOnSave: false,
outputDir: resolve('docs'),
pages: {
index: {
entry: resolve('src/pages/index/main.tsx'),
template: 'public/index.html',
filename: 'index.html',
title: 'plain-design-new',
chunks: ['chunk-vendors', 'chunk-common', 'index'],
},
},
css: {
sourceMap: false,
loaderOptions: {
sass: {
additionalData: `$prefix:'${globalComponentPrefix}'; @import "src/packages/styles/global.import.scss";`
}
},
},
configureWebpack: {
plugins: [
new DefinePlugin({
ENV: JSON.stringify(config),
globalComponentPrefix: JSON.stringify(globalComponentPrefix),
APP_ENV: JSON.stringify(require(resolve(`src/pages/env/config/${process.env.APP_ENV || 'prod'}.js`)))
}),
]
},
chainWebpack(config) {
config.plugins
.delete('prefetch-index')
.delete('preload-index');
config
.plugin('html-index')
.tap((args) => {
args[0].chunksSortMode = 'manual';
return args;
});
config.resolve.alias
.set('@', resolve('src'))
.set('src', resolve('src'))
.set('plain-design', resolve('src/packages'))
// .set('@peryl/react-compose/src/index', resolve('abc'));
// .set('@peryl/react-compose', resolve('node_modules/@peryl/react-compose/src/index'));
if (process.env.NODE_ENV === 'development') {
// config.resolve.alias.set('react-dom', 'react-dom/cjs/react-dom.production.min');
}
config.plugins
.delete('prefetch-index')
.delete('preload-index');
},
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。