Skip to content

Commit

Permalink
infra: add absoluteRuntime
Browse files Browse the repository at this point in the history
# Conflicts:
#	babel.config.js
  • Loading branch information
JLHwung committed Nov 7, 2019
1 parent 754ddba commit 65163eb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion babel.config.js
Expand Up @@ -11,6 +11,7 @@ module.exports = function(api) {
exclude: ["transform-typeof-symbol"],
};
const envOpts = Object.assign({}, envOptsNoTargets);
let transformRuntimeOpts = null;

let convertESM = true;
let ignoreLib = true;
Expand Down Expand Up @@ -50,6 +51,17 @@ module.exports = function(api) {
break;
}

if (includeRuntime) {
const babelRuntimePackageJSONPath = require.resolve(
"@babel/runtime/package.json"
);
const path = require("path");
transformRuntimeOpts = {
version: require(babelRuntimePackageJSONPath).version,
absoluteRuntime: path.dirname(babelRuntimePackageJSONPath),
};
}

const config = {
// Our dependencies are all standard CommonJS, along with all sorts of
// other random files in Babel's codebase, so we use script as the default,
Expand Down Expand Up @@ -123,7 +135,7 @@ module.exports = function(api) {
],
plugins: [
includeRuntime
? ["@babel/transform-runtime", { version: "7.4.4" }]
? ["@babel/transform-runtime", transformRuntimeOpts]
: null,
].filter(Boolean),
},
Expand Down

0 comments on commit 65163eb

Please sign in to comment.