Replies: 4 comments 2 replies
-
Curious: are we doing this, or is our default "esbuild" compiler stripping them? You could add a console log inside of Hopefully, it's something that we're doing, so that we can fix! Otherwise, I wonder if we could do something interesting to "stitch" this back together after the fact. |
Beta Was this translation helpful? Give feedback.
-
OK, thanks for the response. I'll have a look at what's going on in For another transformation process with |
Beta Was this translation helpful? Give feedback.
-
FWIW esbuild should be preserving comments inside dynamic |
Beta Was this translation helpful? Give feedback.
-
Ok, I'm pretty sure the issue with the magic comments is here: https://github.com/pikapkg/snowpack/blob/b21848be11041ad87656617b6b56a5084023e054/snowpack/src/rewrite-imports.ts#L36 The process begins in the I have added a local fix to add webpack's magic comments back in to the rewritten import and it works. If there is any interest in supporting this, let me know and I'll tackle it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
After doing some spelunking in the code base, I see that all comments are being stripped in dynamic imports when the source files are scanned with es-module-lexer.
I was wondering if it would be possible to restore certain comments in these dynamic imports when rewriting the imports. This is not a problem when no bundle plugin is being unused. However, if webpack is used to bundle to snowpack build output all dynamic imports with have numbers for their chunk name as all of the magic comments have been eliminated.
With v2.13.3 I have tried setting the minify and treeshake options to false, but this has no affect.
Beta Was this translation helpful? Give feedback.
All reactions