2022-04-13 11:33:02 +08:00
|
|
|
import { defineConfig } from '@ice/app';
|
2022-04-15 10:53:30 +08:00
|
|
|
import SpeedMeasurePlugin from 'speed-measure-webpack-plugin';
|
2022-11-11 11:02:51 +08:00
|
|
|
import customPlugin from './plugin';
|
2022-03-31 15:12:33 +08:00
|
|
|
|
2022-11-11 11:02:51 +08:00
|
|
|
export default defineConfig(() => ({
|
2023-01-10 22:47:24 +08:00
|
|
|
ssr: true,
|
2022-03-31 15:12:33 +08:00
|
|
|
publicPath: '/',
|
2022-12-06 14:31:35 +08:00
|
|
|
polyfill: 'entry',
|
2022-07-21 15:05:10 +08:00
|
|
|
syntaxFeatures: {
|
|
|
|
exportDefaultFrom: true,
|
|
|
|
},
|
2023-06-07 11:26:01 +08:00
|
|
|
featurePolyfill: {
|
|
|
|
abortcontroller: false,
|
|
|
|
},
|
2023-02-22 12:17:31 +08:00
|
|
|
server: {
|
|
|
|
onDemand: true,
|
|
|
|
format: 'esm',
|
|
|
|
},
|
2022-12-27 10:58:18 +08:00
|
|
|
alias: {
|
|
|
|
'@comp': './src/components',
|
|
|
|
},
|
2022-04-29 16:16:00 +08:00
|
|
|
define: {
|
2023-05-08 12:04:07 +08:00
|
|
|
HAHA: JSON.stringify('HAHA'),
|
2022-04-29 16:16:00 +08:00
|
|
|
'process.env.HAHA': JSON.stringify(true),
|
2023-05-08 12:04:07 +08:00
|
|
|
'process.env': JSON.stringify({}),
|
2022-04-29 16:16:00 +08:00
|
|
|
},
|
2022-07-08 17:34:11 +08:00
|
|
|
transform: (code, id) => {
|
2022-11-11 11:02:51 +08:00
|
|
|
if (id.includes('src/pages') && id.endsWith('.js')) {
|
|
|
|
return code;
|
|
|
|
}
|
|
|
|
return null;
|
2022-07-08 17:34:11 +08:00
|
|
|
},
|
2022-03-31 15:12:33 +08:00
|
|
|
webpack: (webpackConfig) => {
|
|
|
|
if (process.env.NODE_ENV !== 'test') {
|
2022-04-15 10:53:30 +08:00
|
|
|
webpackConfig.plugins?.push(new SpeedMeasurePlugin());
|
2022-03-31 15:12:33 +08:00
|
|
|
}
|
|
|
|
return webpackConfig;
|
|
|
|
},
|
2022-12-08 10:11:43 +08:00
|
|
|
dropLogLevel: process.env.ICE_ENV === 'common' ? 'warn' : 'error',
|
2022-09-07 14:49:54 +08:00
|
|
|
plugins: [
|
2022-11-11 11:02:51 +08:00
|
|
|
customPlugin(),
|
2022-09-07 14:49:54 +08:00
|
|
|
],
|
2022-06-07 14:23:35 +08:00
|
|
|
eslint: true,
|
2023-09-20 15:17:28 +08:00
|
|
|
cssModules: {
|
|
|
|
localIdentName: '[hash:8]',
|
|
|
|
},
|
2022-11-11 11:02:51 +08:00
|
|
|
}));
|