Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[AssetMapper] Revert "Fix JavaScript compiler load imports from JS strings"#54012
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
weaverryan commentedFeb 20, 2024
Dang :/
I think you may be mixing this up with the other spot in
In this situation, we're dealing with userland code, which could look like anything. This was always going to be tricky to do perfectly without actually parsing the JS... my hope was to get it 99.5% correct (which I think we have). For that last 0.5%, I'm not sure. Can we make something to get to 99.999%? Or do we need to provide an "escape hatch" where the user can define special situations where over-matching |
smnandre commentedFeb 20, 2024
This could fix the regexp: https://regex101.com/r/jtTZUA/1 (not handling multi-line enquoted string ... as that does not exist in JS) |
smnandre commentedFeb 20, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Alternative: i opened#54014 (should fix this bug) |
nicolas-grekas commentedFeb 20, 2024
Closing in favor of#54014 then :) |
This PR was squashed before being merged into the 6.4 branch.Discussion----------[AssetMapper] Fix enquoted string pattern| Q | A| ------------- | ---| Branch? | 6.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Issues |Fix#54012| License | MITAlternative to#54012 (fixes the bug and avoid a revert that will reintroduce other previous bugs / missmatches)+ add a test to check things work as expected with the standard `app.js` filecc `@weaverryan` `@nicolas`-grekasCommits-------df618bd [AssetMapper] Fix enquoted string pattern
This reverts commit4fe7828, reversing changes made toad1563b.
Reverts#53652 because it breaks loading app.css on a webapp skeleton.
There are two reasons for this:
import './styles/app.css'and this is matched by the "quoted strings" subpart of the current pattern and thus ignored by the "import" subpart.I don't know how this would be fixed using the regexp only so I'm proposing to revert so that we can consider this before the next release.
/cc@smnandre and@weaverryan
I'm wondering what's the plan on this topic? Couldn't the CDN we use provide some API endpoint that'd prevent us from parsing any JS? Is there any effort ongoing on the topic? Alternatively, shouldn't we switch to a regexp-less parser? (a small state machine that'd be able to split apart comments, strings and code)?