In a project forked from vanilla template with a custom .babelrc, the browser target of env preset is not respected.
For example, setting the browser target to "chrome 68" the ES classes are still compiled to ES5, while in a local setup no transpilation is done at all:
"presets": [
["env", {"targets": {"browsers": ["chrome 68"]}}]
]
I'm trying to use LitElement package which is distributed as unstranspiled ES classes. Mixing transpiled with unstranspiled classes does not work for Custom Elements. Gives a "Class constructor LitElement cannot be invoked without 'new'" error
| Software | Name/Version|
| ---------------- | ---------- |
| 小odesandbox |
| Browser | Chrome 70
| Operating System | Windows 10
We now respect it! Sorry for the inconvenience.
Note that I enabled it for babel 7 only, you can force babel7 by adding @babel/core to the devDependencies.
Hi, it fixed partially and example with lit-element still not working.
See https://codesandbox.io/s/47l21wjlx
I added babel/core to devDependencies and updated babelrc syntax. Set preset to chrome 68 i.e. should not transpile ES classes or async functions
The sandbox own files (src/index.js) are not transpiled (ES class syntax is kept) but dependency (@polymer/lit-element/lib/updating-element.js) is transpiled both classes and async (sandbox fails with "regeneratorRuntime is not defined" error)
Me too face the same issue, irrespective of target it always moves the code to ES5.
seems to ignore browserslist configurations set in package.json
Most helpful comment
Hi, it fixed partially and example with lit-element still not working.
See https://codesandbox.io/s/47l21wjlx
I added babel/core to devDependencies and updated babelrc syntax. Set preset to chrome 68 i.e. should not transpile ES classes or async functions
The sandbox own files (src/index.js) are not transpiled (ES class syntax is kept) but dependency (@polymer/lit-element/lib/updating-element.js) is transpiled both classes and async (sandbox fails with "regeneratorRuntime is not defined" error)