-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
After pilet is packaged, export is added to the content of the module #570
Comments
Sorry I do not understand what the problem is and why this is supposed to be a bug in Piral (rather than either your bundler or SystemJS). The actual bundling is not done by Piral, but by a bundler like Webpack, esbuild, ... (whatever you choose here). The content that is in the pilet is fully processed by the bundler. Can you also condense your problem into a MWE? |
look demo https://stackblitz.com/edit/vitejs-vite-3wa7no Project structure
===================================
Why does pilet compile to change the contents of the npm package, which is a feature of system.js? I looked at the piral-base code,Rewrite the System.constructor.prototype.register content 。 After the code is wrapped by export, it will be executed to _export(...p);, The method does not return, causing the context to be lost |
Well, I actually don't have any more information. These paragraphs
don't make any sense at all. I am not sure what you are trying to tell me there (e.g., "pilet compile to change the contents of the npm package"; a bundled package will in general look different to its original source - but that does not mean that the behavior of the modules inside changed; it should be the same). The other two paragraphs are about runtime behavior when evaluating SystemJS modules, but have nothing to do with the introductory paragraph / problem description ("why does the content look different"). So all in all I still fail to understand the issue. What is the expectation? What is the behavior? Things are bundled, yes, but they are always bundled and if you don't want to bundle them then just write the pilet on your own. No need to use a bundler then. Let's see if we find out what your core issue is, otherwise we'll need to close this one. |
Yeah but looking at it I'd rather say that is an issue with vite (it was never said in the reporting that the bundler used is vite - and that is a vital information here, so I wonder what else is missing from the report). |
I put a return in this code, and it works。 In this line https://github.com/smapiot/piral/blob/HEAD/src/framework/piral-base/src/utils/system.ts#L93
|
I'll try webpack |
Yeah so if I understand you correctly the transformation to SystemJS assumes that the Mind doing a PR then? I wonder if this would need to be done for the 1-argument case, too, but it does not seem necessary. |
Yes, Add return and the problem is solved 。 |
Awesome thanks! |
@FlorianRappl |
It's already published using the |
Bug Report
I wirte a pilet, imported some npm packages 。pilet 打包之后模块的内容会加上一些
export
。Look at the picture below, This is the content compiled by pilet
This is the content compiled by npm package。
Why does pilet compile to change the contents of the npm package, which is a feature of system.js?
I looked at the piral-base code,Rewrite the
System.constructor.prototype.register
content 。https://github.com/smapiot/piral/blob/HEAD/src/framework/piral-base/src/utils/system.ts#L66
After the code is wrapped by export, it will be executed to
_export(...p);
, The method does not return, causing the context to be losthttps://github.com/smapiot/piral/blob/HEAD/src/framework/piral-base/src/utils/system.ts#L93
Please tell me what to do , thanks !
The text was updated successfully, but these errors were encountered: