Parcel 2 Docs: Production Optimizations for API
See original GitHub issue🐛 bug report
When I am using Parcel 2 API from docs I have no JS/CSS minification and process.env.NODE_ENV inlining.
🎛 Configuration (.babelrc, package.json, cli command)
let bundler = new Parcel({
entries: join(__dirname, '../test/demo/index.html'),
distDir: join(__dirname, '../test/demo/build'),
cacheDir: join(__dirname, '../test/demo/.cache'),
defaultConfig: join(__dirname, '../node_modules/@parcel/config-default'),
patchConsole: false,
sourceMaps: false,
scopeHoist: true
})
await bundler.run()
I run this script with NODE_ENV=production ./build.js
🤔 Expected Behavior
Minify JS/CSS by default on NODE_ENV=production or show an option to do it in docs.
😯 Current Behavior
Output has no minification. process.env.NODE_ENV was not replaced to "production".
🔦 Context
Adding minify: true do not fix the problem with replacing process.env.NODE_ENV to "production" in my code.
🌍 Your Environment
| Software | Version(s) |
|---|---|
| Parcel | 2.0.0-nightly.425 |
| Node | 14.14 |
| npm/Yarn | Yarn 1.22.10 |
| Operating System | Fedora 32 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Production - Parcel
Parcel's production mode automatically bundles and optimizes your application for production. It can be run using the parcel build command:
Read more >What you need to know about Parcel 2 - LogRocket Blog
In production mode, Parcel now automatically enables lossless image optimization for JPEGs and PNGs. This decreases the size of images without ...
Read more >How to Bundle a Web App with Parcel.js - DigitalOcean
Using a bundler is useful for optimizing the experience for both the user and developer. Parcel.js is an open-source bundler.
Read more >Using module bundlers with Firebase - Google
From version 9 and higher, the Firebase JavaScript SDK is optimized to work ... your webpack build for production, see their official documentation...
Read more >parcel - npm
Automatic production optimization – Parcel optimizes your whole app for production automatically. This includes tree-shaking and minifying ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yeap,
mode: 'production'works fine. Should we add it to docs?-> https://github.com/parcel-bundler/website/pull/754