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 v2 doesnt ignore targets as specified in the docs

See original GitHub issue

🐛 bug report

🎛 Configuration (.babelrc, package.json, cli command)

{
  "name": "test",
  "version": "1.0.0",
  "description": "Make the coffee",
  "author": "You",
  "license": "MIT",
  "main": "index.js",
  "targets": {
    "main": false
  },
  "engines": {
    "node": ">= 10.0.0"
  },
  "scripts": {
    "build": "parcel build ."
  },
  "devDependencies": {
    "parcel": "2.0.0-beta.1",
  }
}

🤔 Expected Behavior

According to https://v2.parceljs.org/configuration/package-json/#main-%2F-module-%2F-browser, parcel creates automatically a target for “main” if you specify it.

However you can disable it with:

  "targets": {
    "main": false
  },

It should disable the target, hence not try to build your code since there are no targets!

😯 Current Behavior

Parcel try to build your code.

🔦 Context

For monorepos, it would be nice to be able to disable the build for a package using this, or another flag. This way you can use for instance

yarn parcel build packages/*

and disable some packages you don’t want parcel to deal with. This would enable a progressive approach to adopt parcel as a build system for every packages.

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-beta.1
Node 14
npm/Yarn yarn 1.22.10
Operating System linux

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
paeolocommented, Nov 4, 2020

@alphabet-codes Yes that was my expectation before @mischnic told me that was not the case. I came to that conclusion after reading https://v2.parceljs.org/configuration/package-json/#main-%2F-module-%2F-browser so maybe we could add something here in the docs precising how targets works.

or we could add someting in parcel code so it ignores some packages when you use a glob. Anyway, it’s already possible to do the second solution with a custom script, since you can call parcel build with a liste of packages.

0reactions
AceTheCreatorcommented, Nov 5, 2020

@paeolo you’re welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parcel
Parcel can build libraries for multiple targets at once!​​ For example, your source code can be compiled to a modern ES module, a...
Read more >
API - ESBuild
This API call is used by the command-line interface if no input files are provided and the --bundle flag is not present. In...
Read more >
Using module bundlers with Firebase - Google
The code you write is read and processed by a module bundler and then output as a new file or set of files....
Read more >
Parcel - Android Developers
Retrieve a new Parcel object from the pool for use with a specific binder. ... cls, Class : the Class object for the...
Read more >
Migration - Parcel
Some tips for migration from Parcel 1 to Parcel 2. ... Babel Doesn't Read tsconfig.json ... you now should specify that in the...
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