@@ -61,15 +61,14 @@ const getInjectContent = (globalName, globalInject) => {
6161 return `import { ${ exportName } } from "${ moduleSpecifier } "; globalThis.${ globalName } = ${ exportName } ;` ;
6262} ;
6363
64- // Due to the use of dynamic require, bundling `git-diff` is difficult.
65- // However, since it's not used in this use case, we can mock it instead.
66- const mockGitDiff = {
67- name : "mock-git-diff" ,
64+ // Mock packages that are difficult to bundle and not used in the current use case.
65+ const mockPackages = {
66+ name : "mock-packages" ,
6867 setup ( build ) {
69- build . onResolve ( { filter : / ^ g i t - d i f f $ / } , ( args ) => {
70- return { path : args . path , namespace : "git-diff " } ;
68+ build . onResolve ( { filter : / ^ ( g i t - d i f f | c o s m i c o n f i g ) $ / } , ( args ) => {
69+ return { path : args . path , namespace : "mock-packages " } ;
7170 } ) ;
72- build . onLoad ( { filter : / .* / , namespace : "git-diff " } , ( ) => {
71+ build . onLoad ( { filter : / .* / , namespace : "mock-packages " } , ( ) => {
7372 return { contents : "export default null" } ;
7473 } ) ;
7574 } ,
@@ -84,7 +83,7 @@ build({
8483 define : {
8584 global : "globalThis" ,
8685 } ,
87- plugins : [ unenvAlias , unenvInject , mockGitDiff ] ,
86+ plugins : [ unenvAlias , unenvInject , mockPackages ] ,
8887 // Unused drivers are left unbundled as-is.
8988 // Note that future updates to `kysely-codegen` may introduce new drivers.
9089 external : [
0 commit comments