Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add unminified source JS files to builds #1643
Add unminified source JS files to builds #1643
Changes from 16 commits
a15db87
9ba7400
236c61f
b686515
a3ab16a
1b0731d
b7e8e30
b7127d7
888ecdb
693e1db
163082f
232e227
9747f7b
c34ac17
37d8078
0a1354b
6e18901
04f7a75
7af4b07
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Is this missing the flag to say it is minified?
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.
Yes! I just realized this. I should probably make this change in the config for Web Worker Offloading as well, which is copying the partytown files.
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.
This won't attempt to create a minified version of
web-vitals.js
, will 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.
No, actually it's the opposite - setting
info: { minimized: true }
tells Webpack to skip running these files through the minimizer. It's a way to tell Webpack to copy the files 'as is' without trying to minimize them. The documentation specifically mentions this is 'Useful if you need to simply copy *.js files to destination "as is" without evaluating and minimizing them using Terser.'ref: https://webpack.js.org/plugins/copy-webpack-plugin/#skip-running-javascript-files-through-a-minimizer
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, thank you. I'm a little confused. We want to create minified versions of all the scripts, except for those which are copied from
node_modules
, right? So we'd want to copy fromnode_modules/web-vitals/dist
andnode_modules/@builder.io/partytown
as pre-minified, but everything else we'd want to create minified versions for. I don't see how that is all configured here. (I'm a webpack novice!)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.
Let me clarify the current state and what needs to be fixed:
For files from
node_modules
(web-vitals
andpartytown
):build
directory for their respective plugins, we're not telling Webpack that. Currently, I have configured minimization skipping only for the production build.info: { minimized: true }
to prevent re-minification attemptsFor plugin JS files that need minified versions:
optimization-detective/detect.js
is being created (detect.min.js
)embed-optimizer/detect.js
embed-optimizer/lazy-load.js
image-prioritizer/lazy-load.js
I'll update this PR to handle both these cases. Would that address your concerns?
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.
Yes, I believe so!