Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vite.config.js 里按 文档安装后 build 报 vite-plugin-chunk-split/dist/index.cjs not supported.... #43

Open
bin-dogami opened this issue Jul 24, 2024 · 5 comments

Comments

@bin-dogami
Copy link

vite 4.0.0
node v17.0.0

配置按 readme 里来的,错误信息如下:
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/yangbin/coding/dmail/dmail-server/web/node_modules/import-meta-resolve/index.js from /Users/yangbin/coding/dmail/dmail-server/web/node_modules/vite-plugin-chunk-split/dist/index.cjs not supported.

@antoinelrk-ie
Copy link

Same problem

@CherishTheYouth
Copy link

Same Problem

@CherishTheYouth
Copy link

// vite.config.ts

export default defineConfig(async ({ mode }) => {
  const env = loadEnv(mode, process.cwd())
  const { chunkSplitPlugin } = await import('vite-plugin-chunk-split')

Use dynamic import to take effect。

@hijack-621
Copy link

// vite.config.ts

export default defineConfig(async ({ mode }) => {
const env = loadEnv(mode, process.cwd())
const { chunkSplitPlugin } = await import('vite-plugin-chunk-split')
这里动态导入会报错:ypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
at Function.all () ules/vite/dist/node/chunks/dep-jDlp
at asyncFlatten (file:///D:/2024/quotation/node_modules/.pnpm/vite@5.1.4_@types[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-jDlpJiMN.js:12923:26)

@hijack-621
Copy link

vite版本:"vite": "5.1.4"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants