Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

The package fails when using Vite #38

Open
ghost opened this issue Jul 9, 2021 · 3 comments
Open

The package fails when using Vite #38

ghost opened this issue Jul 9, 2021 · 3 comments

Comments

@ghost
Copy link

ghost commented Jul 9, 2021

When using Vite as a builder, running npm run dev results in failure in the browser.

The following is printed in the browser console and the page fails to load.

Uncaught ReferenceError: require is not defined
    <anonymous> NuxtJS

There are no errors in the terminal.

  "dependencies": {
    "nuxt": "^2.15.7",
    "nuxt-mermaid-string": "^2.0.7"
  },
  "devDependencies": {
   "nuxt-vite": "^0.1.1"
  },
@dword-design
Copy link
Owner

dword-design commented Jul 9, 2021

@jsf-3shape I guess it's because it doesn't support ESM yet, right? Vite only works with ESM if I'm not mistaken. ESM is on my list but problem is that some basic tools like ESLint still does not support it, making it complicated to migrate packages. I'm open to suggestions.

@ghost
Copy link
Author

ghost commented Aug 9, 2021

Sorry for the long absence... vacation time.
I'm sure you are correct regarding ESM.
Have you looked in to eslint-config-es?

@dword-design
Copy link
Owner

@jsf-3shape Problem is that the ESLint config loader does not support ESM yet according to their own docs.

JavaScript (ESM) - use .eslintrc.cjs when running ESLint in JavaScript packages that specify "type":"module" in their package.json. Note that ESLint does not support ESM configuration at this time.

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

No branches or pull requests

1 participant