CARVIEW |
Select Language
HTTP/2 200
date: Wed, 15 Oct 2025 04:19:44 GMT
content-type: text/html; charset=utf-8
content-length: 11848
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
server: cloudflare
last-modified: Wed, 15 Oct 2025 00:09:51 GMT
access-control-allow-origin: *
etag: W/"68eee64f-fa2e"
expires: Wed, 15 Oct 2025 04:29:44 GMT
cache-control: max-age=600
content-encoding: gzip
x-proxy-cache: MISS
x-github-request-id: ED8A:3289E4:10D53E:143B71:68EF20DF
accept-ranges: bytes
age: 0
via: 1.1 varnish
x-served-by: cache-bom-vanm7210039-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1760501984.874022,VS0,VE294
vary: Accept-Encoding
x-fastly-request-id: fb78edad9f74f261e33eb9e99728052f802720c2
cf-cache-status: DYNAMIC
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=wOaFcwtnUXAdo5oxW8B0Di%2FokYiWPmO5Ia%2FZiSoHyMp8vNpK4g8BHSqp84Uf80Ms4%2FU%2B63BpXGGnftHczdDJ9wSovhEhun7Li3nI00U%3D"}]}
cf-ray: 98ec8516e8fe860e-BLR
Environment Variables | webpack
Environment Variables
To disambiguate in your webpack.config.js
between development and production builds you may use environment variables.
The webpack command line environment option --env
allows you to pass in as many environment variables as you like. Environment variables will be made accessible in your webpack.config.js
. For example, --env production
or --env goal=local
.
npx webpack --env goal=local --env production --progress
There is one change that you will have to make to your webpack config. Typically, module.exports
points to the configuration object. To use the env
variable, you must convert module.exports
to a function:
webpack.config.js
const path = require('path');
module.exports = (env) => {
// Use env.<YOUR VARIABLE> here:
console.log('Goal: ', env.goal); // 'local'
console.log('Production: ', env.production); // true
return {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
};
};
« Previous
Authoring LibrariesNext »
Build Performance