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

The code that parcel inserts is not processed with babel #131

Closed
chee opened this issue Dec 8, 2017 · 2 comments · Fixed by #169
Closed

The code that parcel inserts is not processed with babel #131

chee opened this issue Dec 8, 2017 · 2 comments · Fixed by #169

Comments

@chee
Copy link

chee commented Dec 8, 2017

🐛/🙋, could go either way.

I think this is related to #8.

if i have this .babelrc:

{"presets": ["es2015"]}

and i have this code:

// index.js
import('./lol').then(console.log)
// lol.js
export default 'lol'

and i do parcel build index.js --no-minify, i get this handy guy in the code:

function requireModule(id) {
  let res = require(id);
  if (res.__esModule) {
     return res.default;
  }
  return res;
}

the let here is problematic in the environment i'm building for, and testing on.

Similarly, when using parcel index.html, the websocket code generating for hot reloading has an arrow function in it.

Possible solution: transpile these generated snippets with the current babel config

@reel
Copy link
Contributor

reel commented Dec 8, 2017

If you use env instead of es2015 and add a lower browser target, does it work?

See https://babeljs.io/docs/plugins/preset-env/

@chee
Copy link
Author

chee commented Dec 8, 2017

@reel

No, 'cause the builtins are inlined as they appear in their files. For instance, hmr in here: https://github.com/parcel-bundler/parcel/blob/3e97493690eb4b9a87b899b30bc0e1b19f0f84f1/src/packagers/JSPackager.js

they aren't transformed along with everything else, so this arrow function for instance, stays an arrow

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

Successfully merging a pull request may close this issue.

2 participants