Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
How do I set webpack mode

I'm trying to configure my script (in package.json) in such a way that I can run webpack in production or development mode via cli.

package.json

"scripts": {
"start": "webpack serve",
"build": "webpack --mode=production"

in my webpack.config.js file, I was expecting process.env.NODE_ENV to equal to whatever I set the mode to be. Instead, I keep getting undefined please how can I make it work

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

For the Dev Server

First, install webpack-dev-server with following command:

npm install webpack-dev-server

Add following line to the package.json script:

"scripts": {
    "start": "webpack-dev-server --mode development"
}

For Production build Add the following line to the scripts section of package.json:

"build": "node_modules/.bin/webpack --mode production"

The scripts section in package.json with both the dev and production build will look like this:

"scripts": {
    "build": "node_modules/.bin/webpack --mode production",
    "start": "webpack-dev-server --mode development" 
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!