Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A shared node/webapp in a single package #1008

Open
mischnic opened this issue Mar 4, 2022 · 3 comments
Open

A shared node/webapp in a single package #1008

mischnic opened this issue Mar 4, 2022 · 3 comments

Comments

@mischnic
Copy link
Member

mischnic commented Mar 4, 2022

Adding engines.node causes "External modules are not supported when building for browser".

So you need to do

  "engines": {
    "node": ">=14.0"
  },
  "targets": {
    "default": {
      "engines": {
        "browsers": ">= 50%"
      }
    }
  }
@eddiemonge
Copy link

  "engines": {
    "node": ">=16",
  },
  "targets": {
    "default": {
      "engines": {
        "browsers": "> 0.5%, last 2 versions, not dead"
      }
    }
  },
  "browserslist": "> 0.5%, last 2 versions, not dead",

It should be reading off of browsersList but if a top level engines is defined, then a targets.defaults needs an engines as well, which is a possible duplicate of browsersList.

@mischnic
Copy link
Member Author

mischnic commented Mar 7, 2022

The "problem" in that case is that either "engines.node" or "browserslist" needs to have a higher precedence to make the default target a node or browser target. I'm actually not sure if browserslist or engines.node wins at the moment

@gcp
Copy link

gcp commented Jun 23, 2022

As explained in the linked ticket, you can hit this case even for things that aren't node apps at all, because some environments use the package.json engines section to figure out what node version to use for the project (even if only to run Parcel itself!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants