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

ReferenceError: module is not defined #1961

Closed
raulfdm opened this issue Jul 19, 2021 · 2 comments
Closed

ReferenceError: module is not defined #1961

raulfdm opened this issue Jul 19, 2021 · 2 comments
Labels

Comments

@raulfdm
Copy link

raulfdm commented Jul 19, 2021

Describe the bug

I'm not sure if this "bug" (or behavior) has Sveltekit as target since it seems some Vite config.

Anyways, I'm currently trying to bring unified to perform in some transformation (md string -> html) client-side, like next-mdx-remote, react-markdown and other libraries does.

However when I try to import like:

<script>
import { unified } from 'unified'
</script>

I got the following error:

[vite] Error when evaluating SSR module /node_modules/is-buffer/index.js:
ReferenceError: module is not defined
    at /node_modules/is-buffer/index.js:8:1
    at instantiateModule (/Users/raul_personal/development/unified-sveltekit/node_modules/vite/dist/node/chunks/dep-11db14da.js:73323:166)

I'm not sure if I need to do some extra config or I'm missing something out.

Reproduction

  1. Access this repo: https://github.com/raulfdm/sveltekit-vite-ssr-error
  2. Follow the instructions there

Logs

[vite] Error when evaluating SSR module /node_modules/is-buffer/index.js:
ReferenceError: module is not defined
    at /node_modules/is-buffer/index.js:8:1
    at instantiateModule (/Users/raul_personal/development/unified-sveltekit/node_modules/vite/dist/node/chunks/dep-11db14da.js:73323:166)

System Info

System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 42.99 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.1 - ~/.asdf/installs/nodejs/14.16.1/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.12 - ~/.asdf/installs/nodejs/14.16.1/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Edge: 89.0.774.57
    Firefox Developer Edition: 90.0
    Safari: 14.1.1
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.131 
    svelte: ^3.34.0 => 3.38.3 

Severity

blocking an upgrade

Additional Information

No response

@raulfdm
Copy link
Author

raulfdm commented Jul 20, 2021

I've notice there's a specific open issue to report this kind of problem to vite via Google forms. I've just done that.

I'm not sure if this issue should remain open but if not, feel free to close

@benmccann
Copy link
Member

Thanks for reporting. We've been trying to reduce these errors. I added some detail in vitejs/vite-plugin-react#30 and will close this in favor of that issue

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

No branches or pull requests

2 participants