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’,
],
});
},