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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin_legacy is not working as expected #424

Open
2 tasks done
alexookah opened this issue Dec 9, 2023 · 0 comments
Open
2 tasks done

plugin_legacy is not working as expected #424

alexookah opened this issue Dec 9, 2023 · 0 comments
Labels
bug: pending triage Something doesn't seem to be working, but hasn't been verified

Comments

@alexookah
Copy link

alexookah commented Dec 9, 2023

  • I have tried upgrading by running bundle update vite_ruby.
  • I have read the troubleshooting section before opening an issue.

Description 馃摉

I am using ViteRails with ViteLegacy and it seems the plugin legacy is not working as expected.
I am trying to use this config to provide replaceAll polyfill:

ViteLegacy({
  targets: ['Chrome 63'],
  modernPolyfills: ['es.string.replace', 'es.string.replace-all', 'esnext.string.replace-all'],  
  polyfills: ['es.string.replace', 'es.string.replace-all', 'esnext.string.replace-all']
}),

It seems that viteLegacy also adds some id's to provide correct polyfills support.

<script nomodule crossorigin id="vite-legacy-polyfill" src="/nested/vite/assets/polyfills-legacy-40tFIzrw.js"></script>
<script nomodule crossorigin id="vite-legacy-entry" data-src="/nested/vite/assets/index-legacy-TfDOTERY.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>

Is this PR maybe related?
It's quite old PR but not sure why it was not never merged. (uses the 4.0 plugin-legacy version. Now there is version 5.0. Maybe it's needed to update for the latest version to support correct legacy same as the plugin legacy does?

Reproduction 馃悶

Created an example repo
https://github.com/alexookah/rails_example
Added a simple test console.log with replaceAll
https://github.com/alexookah/rails_example/blob/master/app/frontend/entrypoints/example_import.js

Screenshots 馃摲

Screenshot 2023-12-09 at 18 52 11

Screenshot 2023-12-09 at 18 52 00

@alexookah alexookah added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: pending triage Something doesn't seem to be working, but hasn't been verified
Projects
None yet
Development

No branches or pull requests

1 participant