当parcel编译我的代码时,它构建js文件就像这样:
"use strict";
// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles
require = function (_require) {
function require(_x, _x2, _x3) {
return _require.apply(this, arguments);
}
require.toString = function () {
return _require.toString();
};
return require;
}(function (modules, cache, entry) {
...
该代码无法运行,因为它试图在“use strict”模式下定义不带require
的变量var|let|const
。
所以我的问题是:为什么它会生成这样的条形码?
所以在this tread他们说升级节点到8.0.0或更高版本解决了这个问题。
以一种有趣的方式BTW ......它神奇地从生成的文件中删除了use strict