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
Commonjs - preserveModules support #1037
Comments
By "invalid" you just mean that there is no extension? Browsers should have no problem reading JavaScript files without extensions as they do not look at extensions at all, they just look at MIME types. It could however be that your server has a problem inferring the correct MIME type if there is no extension. |
Yes that's what I meant. If someone however is using the browser without a server running it won't work. Even with a MIME type specified, having no extension can result in some pretty weird behaviour. I have seen browsers (such as Chrome) cache a home page in place of a vendor resource, and not release it even with a cache reset. In general it's not a great idea to infer the extension of a file. |
I think this and #1031 share an underlying issue. I think the general solution to both these issues is rollup/rollup#4269 - making it so virtual files pick up their filename based upon There have been various other bandaid fixes relating to this issue too rollup/rollup-plugin-commonjs#373 / rollup/rollup-plugin-babel#296 |
Feature Use Case
When preserveModules on output is set to true, the commonjs plugin currently creates invalid files in the _virtual folder. Example of this is something as simple as a import like
When I attach a debugger to the plugin process, the transform is showing
Ext:
.js?commonjs-module
That makes a file in the _virtual folder called
vue-froala.js_commonjs-module
which is not readable in the browser...
Feature Proposal
Change the way new ID's are generated inside the application. Currently in the helper.js, it has multiple SUFFIX's defined. If they were to have a .js extension added to the end, the files would function as expected. While the hack below works alright, it will create weird files with two .js extensions which is not ideal.
The text was updated successfully, but these errors were encountered: