-
Notifications
You must be signed in to change notification settings - Fork 816
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
importScriptsViaChunks checks for .js extension #2164
Conversation
PR-Bot Size PluginChanged File SizesNo file sizes have changed. New FilesNo new files have been added. All File SizesView Table
Workbox Aggregate Size Plugin3.5KB gzip'ed (23% of limit) |
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.
LGTM with one question that definitely shouldn't block merging.
@@ -17,7 +19,10 @@ module.exports = (compilation, chunkNames) => { | |||
const chunk = chunks.find((chunk) => chunk.names.includes(chunkName)); | |||
if (chunk) { | |||
for (const file of chunk.files) { | |||
scriptFiles.add(resolveWebpackURL(publicPath, file)); | |||
// See https://github.com/GoogleChrome/workbox/issues/2161 | |||
if (upath.extname(file) === '.js') { |
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.
I doubt non-js extensions ever happen with webpack chunks, but I wonder if we want to be a bit more forgiving here and accept things like .mjs
. What do you think?
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.
See my comment in the PR description 😄
(
importScripts()
will never play nicely with ES modules, so.mjs
is a non-issue.)
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.
Gah, sorry, missed that!
R: @philipwalton
Fixes #2161
I think this is a reasonable restriction, and allowing developers to customize things to allow for non-
.js
extensions seems like overkill.(
importScripts()
will never play nicely with ES modules, so.mjs
is a non-issue.)