Skip to content

Commit f504bcf

Browse files
committed
chore: enable plugin order
1 parent d76d483 commit f504bcf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/vite/src/node/plugins/index.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,21 @@ export function getSortedPluginsByHook<K extends keyof Plugin>(
143143
const sortedPlugins: Plugin[] = []
144144
// Use indexes to track and insert the ordered plugins directly in the
145145
// resulting array to avoid creating 3 extra temporary arrays per hook
146-
const pre = 0;
147-
let normal = 0;
148-
// post = 0
146+
let pre = 0,
147+
normal = 0,
148+
post = 0
149149
for (const plugin of plugins) {
150150
const hook = plugin[hookName]
151151
if (hook) {
152152
if (typeof hook === 'object') {
153-
// if (hook.order === 'pre') {
154-
// sortedPlugins.splice(pre++, 0, plugin)
155-
// continue
156-
// }
157-
// if (hook.order === 'post') {
158-
// sortedPlugins.splice(pre + normal + post++, 0, plugin)
159-
// continue
160-
// }
153+
if (hook.order === 'pre') {
154+
sortedPlugins.splice(pre++, 0, plugin)
155+
continue
156+
}
157+
if (hook.order === 'post') {
158+
sortedPlugins.splice(pre + normal + post++, 0, plugin)
159+
continue
160+
}
161161
}
162162
sortedPlugins.splice(pre + normal++, 0, plugin)
163163
}

0 commit comments

Comments
 (0)