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

145
Visualizações
Preact and Webpack for Production

Just trying to make sure I am setting up my preact js correct for production.

In my webpack setup with preact, and run npm run build I notice with Bundle Analyzer Plugin the path for the preact js file is

/node_modules/preact/dist/preact.js and not

/node_modules/preact/dist/preact.min.js

I have uglify and minify js set up as well, but just thought it was curious that the minified package is not picked up ?

Entry script within webpack

  entry: { app: './src/index.js', vendor: [ 'preact', 'preact-router' ] },

Npm Run build script

   "build": "cross-env NODE_ENV=production webpack --progress -p --display-modules --display-chunks"

enter image description here

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The default main for preact is dist/preact.js - preact.min.js is there for people who want to take advantage of minification when not applying their own (people hotlinking it off a CDN, for example), and to measure real-world output size.

You're already applying UglifyJS to your bundle by running webpack with the -p flag, so you needn't worry too much about trying to use dist/preact.min.js. It could save a few bytes, but nothing major. The file you're using (dist/preact.js) is actually already run through UglifyJS by Preact, it's just not compressed but not mangled (so the variable names remain intact).

over 4 years ago · Santiago Trujillo 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