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

nodePolyfills breaks pigment-css #349

Closed
paulm17 opened this issue Dec 12, 2024 · 2 comments
Closed

nodePolyfills breaks pigment-css #349

paulm17 opened this issue Dec 12, 2024 · 2 comments

Comments

@paulm17
Copy link

paulm17 commented Dec 12, 2024

Steps to reproduce

Clone: https://github.com/paulm17/pigment-vite
yarn
yarn dev


Create a simple vite app, add in pigment-css.

Add in as a dependency: vite-plugin-node-polyfills and add to vite plugins.

The error will show up:

[plugin:vite-plugin-zero-runtime] ENOENT: no such file or directory, open '/Users/paul/development/src/github/pigment-vite/node_modules/.vite/deps/vite-plugin-node-polyfills_shims_buffer.js'

Current behavior

Crashes with error.

14:33:37 [vite] (client) Pre-transform error: ENOENT: no such file or directory, open '/Users/paul/development/src/github/pigment-vite/node_modules/.vite/deps/vite-plugin-node-polyfills_shims_buffer.js'
  Plugin: vite-plugin-zero-runtime
  File: /Users/paul/development/src/github/pigment-vite/src/App.tsx
14:33:37 [vite] (client) ✨ new dependencies optimized: vite-plugin-node-polyfills/shims/buffer, vite-plugin-node-polyfills/shims/global, vite-plugin-node-polyfills/shims/process
14:33:37 [vite] (client) ✨ optimized dependencies changed. reloading
14:33:37 [vite] Internal server error: ENOENT: no such file or directory, open '/Users/paul/development/src/github/pigment-vite/node_modules/.vite/deps/vite-plugin-node-polyfills_shims_buffer.js'
  Plugin: vite-plugin-zero-runtime
  File: /Users/paul/development/src/github/pigment-vite/src/App.tsx
      at readFileSync (node:fs:441:20)
      at Object.loadAndParse [as loadAndParseFn] (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/Entrypoint.helpers.js:119:97)
      at new Entrypoint (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/Entrypoint.js:40:112)
      at Entrypoint.innerCreate (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/Entrypoint.js:129:27)
      at /Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/Entrypoint.js:85:47
      at EventEmitter.perf (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/utils/EventEmitter.js:45:20)
      at Entrypoint.create (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/Entrypoint.js:84:25)
      at Entrypoint.createChild (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/Entrypoint.js:176:23)
      at BaseAction.processImports (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/generators/processImports.js:22:44)
      at processImports.next (<anonymous>)
      at /Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:66:78
      at EventEmitter.action (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/utils/EventEmitter.js:25:22)
      at BaseAction.emitAction (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:131:39)
      at nextFn (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:66:32)
      at processNext (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:111:28)
      at Object.next (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:120:9)
      at asyncActionRunner (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/actions/actionRunner.js:39:102)
      at asyncActionRunner (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/actions/actionRunner.js:46:28)
      at async asyncActionRunner (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/actions/actionRunner.js:46:22)
      at async asyncActionRunner (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform/actions/actionRunner.js:46:22)
      at async Object.transform (/Users/paul/development/src/github/pigment-vite/node_modules/@wyw-in-js/transform/lib/transform.js:107:20)
      at async TransformPluginContext.transform (/Users/paul/development/src/github/pigment-vite/node_modules/@pigment-css/vite-plugin/build/index.js:168:24)
      at async EnvironmentPluginContainer.transform (file:///Users/paul/development/src/github/pigment-vite/node_modules/vite/dist/node/chunks/dep-yUJfKD1i.js:47001:18)
      at async loadAndTransform (file:///Users/paul/development/src/github/pigment-vite/node_modules/vite/dist/node/chunks/dep-yUJfKD1i.js:40852:27)

Expected behavior

Adding nodePolyfills should not impact pigment-css at all.

Context

I'm running Electron. I'm coming across the issue where process and other node functions are not available.

Using nodePolyfills solves this issue.

Your environment

No response

Search keywords: nodePolyfills

@paulm17 paulm17 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 12, 2024
@paulm17
Copy link
Author

paulm17 commented Dec 12, 2024

Sigh. Adding in

exclude: ['vite-plugin-node-polyfills']

resolves the issue. 🤦‍♂️

@paulm17 paulm17 closed this as completed Dec 12, 2024
@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 12, 2024
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@paulm17 How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

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

1 participant