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

148
Views
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 answers
Answer question

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 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!