Expose the `mode` option for loaders
See original GitHub issueDo you want to request a feature or report a bug? A feature.
What is the current behavior?
Currently, loaders don’t have access to webpack’s mode
option.
What is the expected behavior?
Loaders should have access to mode
.
If this is a feature request, what is motivation or use case for changing the behavior?
Does it make sense to expose the mode
option to loaders? Loaders might use it to apply mode-specific optimizations – e.g., css-loader
could enable minification in the production mode automatically.
This decreases the number of things a user has to know about and configure to make things work right.
(If the option is already exposed – sorry, just point me to it, I haven’t found it.)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:25 (10 by maintainers)
Top Results From Across the Web
expose-loader - webpack
The expose-loader loader allows to expose a module (in whole or in part) to global object ( self , window and global )....
Read more >Webpack migration from v4 to v5, expose-loader throwing error
Here is how we could finally get this to work: (by using exposes= keyword) client: [ "./ts/client-polyfills.ts", ...
Read more >Extending with Loaders - SurviveJS
The official documentation covers the loader API in detail. You can see all fields available through this there. For example, mode is exposed....
Read more >README.md - UNPKG
Getting Started To begin, you'll need to install `expose-loader`: ```console $ npm install expose-loader ... Options | Name | Type | Default |...
Read more >Options Reference - vue-loader
The config format is the same as loaders , but postLoaders are applied after the default loaders. You can use this to post-process...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Feel free to send a PR to expose the
mode
option for loaderswebpack.common.js:
webpack.prod.js:
package.json: