mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Enable useBuiltIns option when compiling for modern JS environments.
Background: https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime#usebuiltins242538dea1855d5dda80
This commit is contained in:
@@ -71,13 +71,26 @@ BCp.processOneFileForTarget = function (inputFile, source) {
|
||||
! excludedFileExtensionPattern.test(inputFilePath)) {
|
||||
|
||||
var extraFeatures = Object.assign({}, this.extraFeatures);
|
||||
var arch = inputFile.getArch();
|
||||
|
||||
if (inputFile.getArch().startsWith("os.")) {
|
||||
if (arch.startsWith("os.")) {
|
||||
// Start with a much simpler set of Babel presets and plugins if
|
||||
// we're compiling for Node 8.
|
||||
extraFeatures.nodeMajorVersion = parseInt(process.versions.node);
|
||||
}
|
||||
|
||||
if (arch !== "web.browser.legacy") {
|
||||
extraFeatures.runtime = {
|
||||
// Import Babel helpers from @babel/runtime/helpers/builtin/*
|
||||
// instead of @babel/runtime/helpers/* to prevent those helper
|
||||
// modules from importing anything from core-js. The polyfills and
|
||||
// shims provided by core-js are not needed in modern JS
|
||||
// environments (browsers and Node), and will be polyfilled by the
|
||||
// ecmascript-runtime-{client,server} packages anyway.
|
||||
useBuiltIns: true
|
||||
};
|
||||
}
|
||||
|
||||
if (! extraFeatures.hasOwnProperty("jscript")) {
|
||||
// Perform some additional transformations to improve compatibility
|
||||
// in older browsers (e.g. wrapping named function expressions, per
|
||||
|
||||
Reference in New Issue
Block a user