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 16, 2019
1 parent b28b832 commit d265617
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
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,10 +135,7 @@ module.exports = function(api) {
],
plugins: [
includeRuntime
? [
"@babel/transform-runtime",
{ version: require("@babel/runtime/package").version },
]
? ["@babel/transform-runtime", transformRuntimeOpts]
: null,
].filter(Boolean),
},
Expand Down

0 comments on commit d265617

Please sign in to comment.