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

Fix issue with vite dev mode #3533

Merged
merged 1 commit into from
Feb 22, 2023
Merged

Fix issue with vite dev mode #3533

merged 1 commit into from
Feb 22, 2023

Conversation

cmdcolin
Copy link
Collaborator

was giving some odd errors with the buffer polyfill. vite is a little funny because at dev time, it uses esbuild, but rollup at production build. this was a dev only esbuild error

Example error from the esbuild globals plugin

The injected path "/home/cdiesh/src/jbrowse-components/embedded_demos/jbrowse-react-linear-genome-view-vite/node_modules/@esbuild-plugins/node-globals-polyfill/_buffer.js" cannot be marked as external

I switched in this PR to polyfill buffer in the entry point (src/main.tsx) rather than in the vite config. buffer and stream are the two main things we still need polyfills for afaik, as well as setting the "global" variable which may be related to the stream polyfill

manually adding buffer polyfill in entrypoint

Example error from the esbuild globals plugin

The injected path "/home/cdiesh/src/jbrowse-components/embedded_demos/jbrowse-react-linear-genome-view-vite/node_modules/@esbuild-plugins/node-globals-polyfill/_buffer.js" cannot be marked as external
@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Feb 22, 2023
@cmdcolin cmdcolin added dependencies Pull requests that update a dependency file and removed needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) labels Feb 22, 2023
@cmdcolin
Copy link
Collaborator Author

gave those errors just on running e.g. yarn dev

@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Merging #3533 (892420a) into main (3212b93) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3533      +/-   ##
==========================================
- Coverage   62.65%   62.64%   -0.01%     
==========================================
  Files         865      865              
  Lines       30258    30258              
  Branches     7261     7261              
==========================================
- Hits        18957    18956       -1     
- Misses      11110    11111       +1     
  Partials      191      191              
Impacted Files Coverage Δ
packages/core/util/index.ts 82.94% <0.00%> (-0.22%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@cmdcolin cmdcolin merged commit 9ca507e into main Feb 22, 2023
@cmdcolin cmdcolin deleted the fix_vite branch February 22, 2023 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant