fix: dedupe linked modules

This commit is contained in:
cha0s 2023-12-01 19:57:18 -06:00
parent a39b5fe178
commit fe1c72033c
2 changed files with 3 additions and 3 deletions

View File

@ -550,7 +550,7 @@ export default class ServerFlecks extends Flecks {
return undefined;
}
runtimeCompiler(resolver, runtime, config, {additionalModuleDirs = [], allowlist = []} = {}) {
runtimeCompiler(resolver, runtime, config, {allowlist = []} = {}) {
// Compile.
const needCompilation = Object.entries(resolver)
.filter(([fleck]) => this.constructor.fleckIsCompiled(resolver, fleck));
@ -579,7 +579,8 @@ export default class ServerFlecks extends Flecks {
const resolved = dirname(R.resolve(join(root, 'package.json')));
const sourcepath = this.constructor.sourcepath(resolved);
const sourceroot = join(sourcepath, '..');
additionalModuleDirs.push(join(sourceroot, 'node_modules'));
// Alias this compiled fleck's `node_modules` to the root `node_modules`.
config.resolve.alias[join(sourceroot, 'node_modules')] = join(FLECKS_CORE_ROOT, 'node_modules');
const configFile = this.buildConfig('babel.config.js');
debugSilly('compiling: %s with %s', root, configFile);
const babel = {

View File

@ -68,7 +68,6 @@ module.exports = async (config, env, argv, flecks) => {
];
config.resolve.alias['@flecks/server/runtime$'] = runtime;
const nodeExternalsConfig = {
additionalModuleDirs: [],
allowlist,
};
flecks.runtimeCompiler(flecks.resolver, 'server', config, nodeExternalsConfig);