Linux 系统下,无法同时执行 start 和 build 命令
- Dominant language
- TypeScript
- Stars
- 18.6k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
在执行 start 命令后,执行 build 命令,会出现上图的错误。将 @ice/app 版本回退到 3.4.11 后便不会出现这种问题。
### Expected behavior
希望可以在执行 start 时,也可以执行 build 命令。
### Actual behavior
_No response_
### Version of ice.js
3.6.5
### Content of build.json or ice.config.mts
```TypeScript
import { defineConfig } from '@ice/app';
import icestark from '@ice/plugin-icestark';
import def from '@ali/ice-plugin-def';
import request from '@ice/plugin-request';
import provider from './provider-plugin';
import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
import webpack from 'webpack';
export default defineConfig(() => ({
ssg: false,
codeSplitting: false,
devPublicPath: `http://127.0.0.1:${process.env.ICE_CORE_DEV_PORT}/`,
plugins: [icestark({
type: 'child'
}), def(), request(), provider()],
routes: {
ignoreFiles: ['**/components/**', '**/context.ts', '**/enum.ts', '**/tools.ts', '**/constant.ts']
},
externals: {
react: 'React',
'react-dom': 'ReactDOM',
antd: 'antd',
dayjs: 'dayjs'
},
postcss: {
plugins: [['tailwindcss', {}], ['autoprefixer', {}]]
},
webpack: config => {
config.cache = {
type: 'filesystem',
compression: 'gzip',
buildDependencies: {
config: ['./ice.config.mts', './package.json']
}
};
config.plugins?.push(new webpack.NormalModuleReplacementPlugin(/node:/, resource => {
const mod = resource.request.replace(/^node:/, '');
resource.request = mod;
}) as any, new NodePolyfillPlugin() as any);
// 增加 style-loader,将 css 样式打包到 js 文件中,以解决 css 样式串行加载导致的加载性能问题
config.module?.rules?.forEach((rule: any) => {
if (['/\\.css$/', '/\\.less$/', '/\\.scss$/'].includes(rule?.test?.toString())) {
rule.use = rule.use.filter(item => !item.loader.includes('mini-css-extract-plugin'));
rule.use.unshift({
loader: 'style-loader'
});
}
});
config.module?.rules?.unshift({
test: /\.m?js$/,
resolve: {
fullySpecified: false
}
});
// @ts-ignore
config.devServer.client.overlay = false;
return config;
}
}));
```
### Additional context
_No response_
Contributor guide
Research direction
Reproduce the failure on Linux with @ice/app 3.6.5 using the provided ice.config.mts and package.json, running start followed by build; compare the behavior with version 3.4.11. Trace the start and build entry points and their shared build state, then verify that both commands complete successfully together.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, nodejs, react, typescript, webpack
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100