alibaba / ice

🚀 ice.js: The Progressive App Framework Based On React(基于 React 的渐进式应用框架)
https://ice.work
MIT License
17.83k stars 2.09k forks source link

无法使用i18next-hmr插件 #6766

Closed justrustc closed 7 months ago

justrustc commented 7 months ago

Describe the bug

编译报错

Expected behavior

正常编译

Actual behavior

image

Version of ice.js

3.4.2

Content of build.json or ice.config.mts

import path from 'path'
import { fileURLToPath } from 'url'
import { I18NextHMRPlugin } from 'i18next-hmr/webpack'

const __dir = path.dirname(fileURLToPath(import.meta.url))

export default defineConfig(() => ({
  webpack(config) {
    if (process.env.NODE_ENV === 'development') {
      config.plugins!.push(
        new I18NextHMRPlugin({
          localesDir: path.join(__dir, 'public/locales'),
        }),
      )
    }
    return config
  },
}))

Additional context

No response

ClarkXia commented 7 months ago

工程上默认开启了基于 rspack 的 speedup 模式,如果三方 webpack 插件 API 还未兼容,可以先关闭 speedup 模式 修改 package.json 下的 start 脚本,去掉 --speedup 即可