Skip to content

Commit f99796e

Browse files
AmyFoxFNhaoqunjiang
authored andcommitted
fix(preset): plugin invoke order don't sort by unicode order (#2656)
1 parent 6fd5e5d commit f99796e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/@vue/cli/lib/Creator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ module.exports = class Creator extends EventEmitter {
310310
// { id: options } => [{ id, apply, options }]
311311
async resolvePlugins (rawPlugins) {
312312
// ensure cli-service is invoked first
313-
rawPlugins = sortObject(rawPlugins, ['@vue/cli-service'])
313+
rawPlugins = sortObject(rawPlugins, ['@vue/cli-service'], true)
314314
const plugins = []
315315
for (const id of Object.keys(rawPlugins)) {
316316
const apply = loadModule(`${id}/generator`, this.context) || (() => {})

packages/@vue/cli/lib/util/sortObject.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = function sortObject (obj, keyOrder) {
1+
module.exports = function sortObject (obj, keyOrder, dontSortByUnicode) {
22
if (!obj) return
33
const res = {}
44

@@ -11,7 +11,7 @@ module.exports = function sortObject (obj, keyOrder) {
1111

1212
const keys = Object.keys(obj)
1313

14-
keys.sort()
14+
!dontSortByUnicode && keys.sort()
1515
keys.forEach(key => {
1616
res[key] = obj[key]
1717
})

0 commit comments

Comments
 (0)