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

breaks when imported into esm module #241

Closed
bhvngt opened this issue Sep 27, 2021 · 0 comments · Fixed by #242
Closed

breaks when imported into esm module #241

bhvngt opened this issue Sep 27, 2021 · 0 comments · Fixed by #242
Labels
bug Something isn't working

Comments

@bhvngt
Copy link
Contributor

bhvngt commented Sep 27, 2021

Describe the bug

The latest build breaks when it is imported into esm module with following error

[vite-plugin-windicss:devtools] Could not load /@windicss/devtools (imported by src/routes/index.svelte): __dirname is not defined
> Could not load /@windicss/devtools (imported by src/routes/index.svelte): __dirname is not defined
ReferenceError: Could not load /@windicss/devtools (imported by src/routes/index.svelte): __dirname is not defined
    at Object.load (file:///Volumes/common/temp/node_modules/.pnpm/vite-plugin-windicss@1.4.7_typescript@4.4.3/node_modules/vite-plugin-windicss/dist/index.mjs:210:56)
    at /Volumes/common/temp/node_modules/.pnpm/rollup@2.57.0/node_modules/rollup/dist/shared/rollup.js:22620:25
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

This is because __dirname is used by devtools which is now deprecated for esm modules by node

Minimal Reproductions

Versions

  • vite-plugin-windicss: v1.4.7
  • vite: v2.5.10
  • framework(vue/react/svelte/etc): svelte

Additonal Context
I am raising a PR to fix this issue.

@bhvngt bhvngt added the bug Something isn't working label Sep 27, 2021
antfu added a commit that referenced this issue Sep 28, 2021
* fix(241): makes devtools esm compatible by addressing reference to depeprecated __dirname global variable

* chore: update

Co-authored-by: Bhavin <bhavinkamani@gmail.com>
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant