question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aicommented, Oct 16, 2020

Yeap, mode: 'production' works fine. Should we add it to docs?

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found