Skip to content

Commit 4e0edc5

Browse files
committed
Make sure globals can be overridden too
1 parent 66e9664 commit 4e0edc5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => {
159159
}
160160

161161
const toOverride = (name: BareModuleName): string | void => {
162+
if (name in optionsResolved.overrides) {
163+
return optionsResolved.overrides[name]
164+
}
165+
162166
if (/^buffer$/.test(name)) {
163167
return 'vite-plugin-node-polyfills/shims/buffer'
164168
}
@@ -170,10 +174,6 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => {
170174
if (/^process$/.test(name)) {
171175
return 'vite-plugin-node-polyfills/shims/process'
172176
}
173-
174-
if (name in optionsResolved.overrides) {
175-
return optionsResolved.overrides[name]
176-
}
177177
}
178178

179179
const polyfills = (Object.entries(stdLibBrowser) as Array<[ModuleName, string]>).reduce<Record<ModuleName, string>>((included, [name, value]) => {

0 commit comments

Comments
 (0)