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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parcel does not transpile es6 scripts to es5 #9039

Closed
andy-57blocks opened this issue May 26, 2023 · 1 comment
Closed

Parcel does not transpile es6 scripts to es5 #9039

andy-57blocks opened this issue May 26, 2023 · 1 comment

Comments

@andy-57blocks
Copy link

馃悰 bug report

Parcel does not transpile es6 scripts to es5

馃帥 Configuration (.babelrc, package.json, cli command)

package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "source": "src/index.html",
  "scripts": {
    "start": "parcel",
    "build": "parcel build --no-source-maps"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.12.0",
    "parcel": "^2.9.0"
  },
  "browserslist": "> 0.001%"
}

src/index.html

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <title>My First Parcel App</title>
    <link rel="stylesheet" href="styles.css" />
    <script type="module" src="app.js"></script>
  </head>
  <body>
    <h1>Hello, World!</h1>
  </body>
</html>

src/app.js

let objA = {
  a: 'aa',
  b: 'bb'
}
let objB = {
  b: 'dd',
  c: 'ee'
}
let result = Object.assign({}, objA, objB)
result.a = 'cc'
console.log(objA, result) 

馃 Expected Behavior

When running yarn build, Parcel should transpile Object.assign or add polyfill for it

馃槸 Current Behavior

Code is not transpiled to be compatible with other old browsers
image

dist/index.b6cad3e0.js

!function(){var a={a:"aa",b:"bb"},c=Object.assign({},a,{b:"dd",c:"ee"});c.a="cc",console.log(a,c)}();

馃拋 Possible Solution

馃敠 Context

馃捇 Code Sample

馃實 Your Environment

Software Version(s)
Parcel 2.9.0
Node 18.13.0
npm/Yarn 8.19.3
Operating System mac
@mischnic
Copy link
Member

mischnic commented May 26, 2023

See #7419 (comment)

For now, install core-js and add import "core-js/modules/es.object.assign.js";

@mischnic mischnic closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2023
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

2 participants