meatier
meatier copied to clipboard
set module directory in babel
currently some files use relative directories because although webpack knows to look in src
, the server doesn't use webpack & gets lost (see ducks, or any other SSR file). To solve this, i can add the module directory to babel on the server & then all paths can be written as absolutes but be relative to src
.
untested code example:
resolveModuleSource: function (source, filename) {
return resolve.sync(source, {
basedir: path.resolve(filename, ‘..’),
extensions: [‘.js’],
moduleDirectory: [
‘src’,
‘node_modules’,
],
});
},
I'm looking into this. I had to make worker.babel.js
to get resolution to work in the worker process as well as the server process.
Right now it's breaking AVA tests because I can't figure out how to get AVA to run the custom babel-register
before each and every test in the glob pattern...