Skip to content

Commit

Permalink
Pass extensions to load as modules to Babel provider
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Jan 5, 2020
1 parent 6995471 commit e919b40
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions lib/worker/subprocess.js
Expand Up @@ -112,19 +112,19 @@ ipc.options.then(options => {
handleUncaughtExceptions: false
});

const extensionsToLoadAsModules = Object.entries(options.moduleTypes)
.filter(([, type]) => type === 'module')
.map(([extension]) => extension);

// Install before processing options.require, so if helpers are added to the
// require configuration the *compiled* helper will be loaded.
let babelProvider;
if (options.babelState !== null) {
const {projectDir} = options;
babelProvider = babelManager({projectDir}).worker({state: options.babelState});
babelProvider = babelManager({projectDir}).worker({extensionsToLoadAsModules, state: options.babelState});
runner.powerAssert = babelProvider.powerAssert;
}

const extensionsToLoadAsModules = Object.entries(options.moduleTypes)
.filter(([, type]) => type === 'module')
.map(([extension]) => extension);

let requireFn = require;
const load = ref => {
for (const extension of extensionsToLoadAsModules) {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -110,7 +110,7 @@
"yargs": "^15.1.0"
},
"devDependencies": {
"@ava/babel": "^0.5.0",
"@ava/babel": "^0.6.0",
"@types/node": "^10.17.13",
"ansi-escapes": "^4.3.0",
"delay": "^4.3.0",
Expand Down

0 comments on commit e919b40

Please sign in to comment.