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

Build breaks with browserslist configuration "supports es6-module" #6749

Closed
01231 opened this issue Aug 22, 2021 · 4 comments · Fixed by #7399
Closed

Build breaks with browserslist configuration "supports es6-module" #6749

01231 opened this issue Aug 22, 2021 · 4 comments · Fixed by #7399

Comments

@01231
Copy link

01231 commented Aug 22, 2021

🐛 bug report

The build crashes. I found out when I remove this statement "browserslist": "supports es6-module" in the package.json the build works flawless.

🎛 Configuration (package.json)

{
  "name": "project",
  "version": "0.1.0",
  "description": "",
  "source": "src/index.html",
  "browserslist": "supports es6-module",
  "scripts": {
    "start": "parcel --open chrome",
    "build": "parcel build"
  },
  "repository": "",
  "author": "",
  "license": "MIT",
  "dependencies": {
    "eslint-config-airbnb": "^18.2.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^3.4.0"
  },
  "devDependencies": {
    "parcel": "^2.0.0-rc.0"
  }
}

🤔 Expected Behavior

In my opinion this should just work out of the box. I did run npx browserslist 'supports es6-module' to test if this is a valid query for browserslist and it did work.

😯 Current Behavior

This is the output when running yarn build.

$ parcel build
🚨 Build failed.

@parcel/transformer-js: Invalid Version: TP.0.0

  TypeError: Invalid Version: TP.0.0
  at new SemVer
  (.../project/node_modules/semver/semver.js:323:11)
  at compare
  (.../project/node_modules/semver/semver.js:614:39)
  at Function.gt
  (.../project/node_modules/semver/semver.js:643:10)
  at Object.transform
  (.../project/node_modules/@parcel/transformer-js/lib/JSTransformer.js:312:58)
  at processTicksAndRejections
  (internal/process/task_queues.js:95:5)
  at async Transformation.runTransformer
  (.../project/node_modules/@parcel/core/lib/Transformation.js:604:5)
  at async Transformation.runPipeline
  (.../project/node_modules/@parcel/core/lib/Transformation.js:357:36)
  at async Transformation.runPipelines
  (.../project/node_modules/@parcel/core/lib/Transformation.js:241:40)
  at async Transformation.run
  (.../project/node_modules/@parcel/core/lib/Transformation.js:167:19)
  at async Child.handleRequest
  (.../project/node_modules/@parcel/workers/lib/child.js:217:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

💁 Possible Solution

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel ^2.0.0-rc.0
Node v14.17.0.
npm/Yarn 1.22.11
Operating System macOS Big Sur 11.4
@devongovett
Copy link
Member

Seems like potentially an issue with browserslist. They should be returning a version number. I'm not sure what TP is...

@mischnic
Copy link
Member

let [name, version] = browser.split(' ');
if (BROWSER_MAPPING.hasOwnProperty(name)) {
name = BROWSER_MAPPING[name];
if (!name) {
continue;
}
}
let [major, minor = '0', patch = '0'] = version
.split('-')[0]
.split('.');
let semverVersion = `${major}.${minor}.${patch}`;
if (
targets[name] == null ||
semver.gt(targets[name], semverVersion)
) {
targets[name] = semverVersion;
}

browser is "safari TP", then semverVersion is TP.0.0 which is of course an invalid version number

@cekvenich2
Copy link

Watching.

@cekvenich2 cekvenich2 mentioned this issue Aug 30, 2021
Closed
@folknor
Copy link

folknor commented Oct 8, 2021

In fact the bug is with any valid supports foo keyword, as far as I can see - I tested 6 of them.
EDIT: Ah, I read the relevant code above now, please excuse my unnecessary comment.

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

Successfully merging a pull request may close this issue.

5 participants