Add option to turn off CopyWebpackPlugin minification for asset #23410
Replies: 4 comments 1 reply
-
The best take over webpack customization would be eventually to export the building blocks of it (ts, react, styles, modification) as functions and expose a webpack configuration for every generated project. This way, we could customize it entirely to our demands. I'll open a feature request for that. |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
Beta Was this translation helpful? Give feedback.
-
Any updates on this @danr-za? Did we get a feature request for this? |
Beta Was this translation helpful? Give feedback.
-
The workaround for now would be to set I think we could add |
Beta Was this translation helpful? Give feedback.
-
Description
Allow an additional option to be passed to the
CopyWebpackPlugin
for assets to prevent minification.Motivation
Currently we use the assets feature of nx to copy files from app builds into deploy projects that are already minified.
Unfortunately there is currently no way to pass the
info: { minimized: true },
option to theCopyWebpackPlugin
.This results in JS files being re-minified, or minified when they shouldn't be (because the build project has optimization off).
Another use case we have is JS that we are sent as an asset and need the copy plugin to leave the JS alone during the copy.
Suggested Implementation
Add an additional option to the assets object in
project.json
to sendminimized: true
, that will then be passed to theCopyWebpackPlugin
for that asset.See
nx/packages/webpack/src/utils/config.ts
Line 327 in 60a7345
Alternate Implementations
We could also send exclude options to the
TerserWebpackPlugin
, but I think signaling the assets in the copy plugin is easier and more maintainable.Beta Was this translation helpful? Give feedback.
All reactions