Skip to content

Commit db7100f

Browse files
committed
Make sure globals can be overridden too
1 parent 4ebf70a commit db7100f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => {
151151
}
152152

153153
const toOverride = (name: BareModuleName): string | void => {
154+
if (name in optionsResolved.overrides) {
155+
return optionsResolved.overrides[name]
156+
}
157+
154158
if (/^buffer$/.test(name)) {
155159
return 'vite-plugin-node-polyfills/shims/buffer'
156160
}
@@ -162,10 +166,6 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => {
162166
if (/^process$/.test(name)) {
163167
return 'vite-plugin-node-polyfills/shims/process'
164168
}
165-
166-
if (name in optionsResolved.overrides) {
167-
return optionsResolved.overrides[name]
168-
}
169169
}
170170

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

0 commit comments

Comments
 (0)