Skip to content

Commit

Permalink
Resolve monorepo package paths in esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsherman committed Dec 9, 2024
1 parent adcbc7c commit d97c42a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apps/website/_config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { resolve } from 'jsr:@std/path';

import lume from 'lume/mod.ts';

import date from 'lume/plugins/date.ts';
Expand Down Expand Up @@ -37,6 +39,22 @@ site.use(
minify: false,
platform: 'browser',
target: 'esnext',
plugins: [
{
name: 'import-map-alias',
setup(build) {
build.onResolve({ filter: /^@mg5dev\/(.+)$/ }, (args) => {
const packageName = args.path.replace('@mg5dev/', '');
const resolvedPath = resolve(
'../../packages',
packageName,
'mod.ts'
);
return { path: resolvedPath, namespace: 'file' };
});
},
},
],
},
})
);
Expand Down

0 comments on commit d97c42a

Please sign in to comment.