0

Prepare these two files.

package.json

{
  "dependencies": {
    "lit-html": "^1.1.0"
  },
  "browserslist": [
    "IE 11"
  ]
}

index.js

import {html, render} from "lit-html"

const foo = () => {}

Then, build them with parcel.

parcel build index.js

A part of result is

"use strict";var t=require("lit-html"),i=function(){};

The arrow function is compiled to standard function expression. This is the expected behavior.

However, there are some arrow functions in the result.

t=t=>(...s)=>{const

This is part of lit-html module.

Can parcel compile to ES5 including dependent modules?

Leftium
  • 16,497
  • 6
  • 64
  • 99
blz
  • 837
  • 7
  • 20

1 Answers1

0

please look into this link : https://github.com/parcel-bundler/parcel/issues/1037

{
"name": "pc",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"parcel-bundler": "^1.6.2"
},
"private": true,
"scripts": {
"build": "parcel build src/index.js"
},
"dependencies": {
"sweetalert2": "^7.17.0"
}
}
  • I already read it, but I do not understand well. Does it mean that it is impossible if dependant modules does not support `source` option? – blz Jun 11 '19 at 14:07