About the Build Mode with Webpack
You would build the Webpack bundle for development with:
1 |
|
and for production with:
1 |
|
To know whether the current build is in development mode or production mode, you should use webpack.DefinePlugin()
in webpack.config.js
:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Then in your bundled JavaScript files you can have this checking:
1 2 3 4 5 |
|
Note that PRODUCTION
here will work not as a global variable, but as a template variable resolved to true
or false
.
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You