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

Ability to use native-loader esm #1548

Closed
sionzee opened this issue Jan 15, 2021 · 1 comment
Closed

Ability to use native-loader esm #1548

sionzee opened this issue Jan 15, 2021 · 1 comment

Comments

@sionzee
Copy link

sionzee commented Jan 15, 2021

Is your feature request related to a problem? Please describe.
At issue #1511 you have mentioned the vite is not using native-loader and would be great to use once it is stable.
I was using type: module since Vite 2.0.0.beta.1 even in Vite 1.x.x.beta and everything was working fine.

The issues came in at Vite 2.0.0.beta.22 so I'm stuck to Vite 2.0.0.beta.21.
Seems the current loader has an issue to parse even a RegExp. (I also know the transform fix for Import.meta is not proper)

For example try to parse this regex in vite.config.ts when you have type as module.

const test = /([\w_]+)\sas\s([\w_]+),?/g

You will get:

SyntaxError: Invalid regular expression: missing /
    at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async link (internal/modules/esm/module_job.js:47:21)

And that is because of the question mark at the end. (the regex is fully valid and is working in beta.21)

Vite version: vite/2.0.0-beta.29 linux-x64 node-v14.15.4
System: WSL

Describe the solution you'd like
As you mentioned in the issue #1511 I would like to have ability to use native-loaders which will resolve the two issues above (even when the one is temporary fixed) and next upcoming esm issues.

@yyx990803
Copy link
Member

Can you provide a reproduction? This probably is fixable by base64 encoding the inline module.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants