Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

106
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda