-
Notifications
You must be signed in to change notification settings - Fork 915
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
fix source map stripping issue #1146
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/pikapkg/snowpack/nfajjmwt2 |
@@ -9,7 +9,7 @@ export function rollupPluginStripSourceMapping(): Plugin { | |||
return { | |||
name: 'snowpack:rollup-plugin-strip-source-mapping', | |||
transform: (code) => ({ | |||
code: code.replace(/\/\/+#\s*sourceMappingURL=.+$/gm, ''), | |||
code: code.replace(/[^'"`]\/\/+#\s*sourceMappingURL=.+$/gm, ''), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so this doesn’t strip the source map if a string character is right before it?
This works for me. But I wonder if there’s a way to also change this so that it only strips it if it’s literally the last thing in the file (which may or may not end on a newline). This doesn’t have to be on its own line, but I’ve never seen it mid-file before; only at the end.
Something like (pseudocode)
/\/\/#s\*sourceMappingURL=[A-Za-z0-9-/:.]+\n?$/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, unfortunately, I've seen a few mid-file, usually when the package has been pre-bundled in some way. But, there's a chance that esinstall actually caused that, and each individual transform had only one sourceMappingURL
comment.
This is enough for now and I don't want a regression unnecessarily, but if there are still bugs after this then let's revisit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I thought there was a reason for scanning mid-file. Bug found 🙃 : #1505
docs/_eleventy/layouts/base.njk
Outdated
.markdown-body, .grid-body-header, .toc { | ||
padding: 0 1em; | ||
} | ||
|
||
.grid-nav-container { | ||
width: 100vw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
100%
never does what you think it will, does it? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha sadly, no
38a9646
to
37b1ba5
Compare
Changes
Testing