准备这两个文件。
package.json
{
"dependencies": {
"lit-html": "^1.1.0"
},
"browserslist": [
"IE 11"
]
}
index.js
import {html, render} from "lit-html"
const foo = () => {}
然后,用包裹建造它们。
parcel build index.js
部分结果是
"use strict";var t=require("lit-html"),i=function(){};
箭头函数被编译为标准函数表达式。这是预期的行为。
但是,结果中有一些箭头功能。
t=t=>(...s)=>{const
这是lit-html模块的一部分。
包裹可以编译到包括相关模块的ES5吗?
答案 0 :(得分:0)
请查看此链接: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"
}
}