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

Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/vitedge/plugin.js not supported. #54

Closed
mihailtd opened this issue Aug 19, 2021 · 2 comments

Comments

@mihailtd
Copy link

mihailtd commented Aug 19, 2021

Hello, I am trying to run vitessedge-template, however when running npm run dev I get the following error:

/home/mihai/health-plus/@app/homepage/vite.config.ts:37
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
                               ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/user/projeect/@app/homepage/node_modules/vitedge/plugin.js from /home/user/project/@app/homepage/vite.config.ts not supported.
Instead change the require of plugin.js in /home/user/projeect/@app/homepage/vite.config.ts to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/user/projeect/@app/homepage/vite.config.ts:37:32)
    at Object.require.extensions.<computed> [as .ts] (/home/user/projeect/node_modules/vite/dist/node/chunks/dep-98dbe93b.js:76005:20)
    at loadConfigFromBundledFile (/home/user/projeect/node_modules/vite/dist/node/chunks/dep-98dbe93b.js:76013:17)
    at loadConfigFromFile (/home/user/projeect/node_modules/vite/dist/node/chunks/dep-98dbe93b.js:75932:32)
    at async resolveConfig (/home/user/projeect/node_modules/vite/dist/node/chunks/dep-98dbe93b.js:75504:28)
    at async getProjectInfo (file:///home/user/projeect/@app/homepage/node_modules/vitedge/config.js:5:18)
    at async file:///home/user/projeect/@app/homepage/node_modules/vitedge/bin/cli.js:38:22 {
  code: 'ERR_REQUIRE_ESM'
}

import statement is import vitedge from "vitedge/plugin.js";

env:
node v16.7.0 but also tried 14.17.0
vite v2.4.4
typescript 4.4.1-rc
vitedge: 0.15.1 but also tried 0.15.0 and 0.14.0

Any ideeas? Thanks!

@frandiox
Copy link
Owner

Hi! Did you change anything in the template? It works for me with both Node 14 and 16 🤔
Are you on Windows by any chance?

Can you also try npm run preview:watch and see if at least that works?

@mihailtd
Copy link
Author

Hi, Thanks for the answer!
The problem seems to be because of my monorepo setup with yarn - some dependency mismatch.

I will keep investigating however, this issue can be closed since I was able to run the template independently outside of my monorepo with no problem.

Thanks again!

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

2 participants