Public commit
This commit is contained in:
14
scripts/plugins/esbuild-external-dep.ts
Normal file
14
scripts/plugins/esbuild-external-dep.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import type * as esbuild from "esbuild"
|
||||
|
||||
export const externalDep = (externals: string[]): esbuild.Plugin => ({
|
||||
name: "externalDep",
|
||||
setup(build) {
|
||||
for (const module of externals) {
|
||||
const resolved: esbuild.OnResolveResult = {
|
||||
path: `/vendor/${module}/index.js`,
|
||||
external: true,
|
||||
}
|
||||
build.onResolve({ filter: RegExp(`^${module}$`) }, () => resolved)
|
||||
}
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user