ice
ice copied to clipboard
ice3.x使用copy-webpack-plugin时,npm run start会卡住
Describe the bug
使用copy-webpack-plugin时,npm run start会阻塞,直接卡在Compiling task web... 具体的配置文件如下
import { defineConfig } from '@ice/app';
import request from '@ice/plugin-request';
import store from '@ice/plugin-store';
import auth from '@ice/plugin-auth';
// const CopyPlugin = require('copy-webpack-plugin');
import CopyPlugin from 'copy-webpack-plugin';
import path from 'path';
const CONFIG_FILE = process.env.CONFIG_FILE || 'development';
// The project config, see https://v3.ice.work/docs/guide/basic/config
const minify = process.env.NODE_ENV === 'production' ? 'swc' : false;
export default defineConfig(() => ({
ssg: false,
minify,
plugins: [
request(),
store(),
auth()
// CopyPlugin()
// new CopyPlugin({
// patterns: [
// {
// // from: path.resolve(__dirname, `./config/config.${CONFIG_FILE}.js`),
// from: `./config/config.${CONFIG_FILE}.js`,
// to: `./${process.env.ICE_BASE_CONFIG_PATH}`
// }
// ]
// })
],
compileDependencies: false,
devPublicPath: '/',
externals: {
l3d: 'L3d',
cesium: 'Cesium',
envSetting: 'GLOBAL_CONFIG' // 配置文件
},
// 配置开发环境代理
proxy: {
// 影像缩略图配置跨域
'/thumbnail': {
target: 'https://cgwx-jpg.obs.cn-north-4.myhuaweicloud.com/',
changeOrigin: true,
pathRewrite: { '^/thumbnail': '' }
}
},
webpack: (config) => {
config.plugins?.push(
new CopyPlugin({
patterns: [
{
from: path.resolve(`./config/config.${CONFIG_FILE}.js`),
to: `./${process.env.ICE_BASE_CONFIG_PATH}`
}
]
})
);
// Remove rule of .svg
config.module.rules = config.module.rules.filter((rule) => {
if (rule.test instanceof RegExp) {
return !rule.test.test('.svg');
}
return true;
});
// Add rule of .svg with @svgr/webpack
config.module.rules.push({
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {}
}
]
});
return config;
}
}));
Expected behavior
正常使用copy-webpack-plugin
Actual behavior
No response
Version of ice.js
3.4.9
Content of build.json or ice.config.mts
No response
Additional context
npm run build时,可以正常使用