Skip to content

Commit f00eedc

Browse files
committed
chore: fix npm build scripts on windows
1 parent a6a50a6 commit f00eedc

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

modules/TransitionUtils.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,20 @@ const enterHooks = new PendingHooks()
1212
const changeHooks = new PendingHooks()
1313

1414
function createTransitionHook(hook, route, asyncArity, pendingHooks) {
15+
const isSync = hook.length < asyncArity
16+
1517
const transitionHook = (...args) => {
1618
hook.apply(route, args)
1719

18-
if (hook.length < asyncArity) {
20+
if (isSync) {
1921
let callback = args[args.length - 1]
20-
// Add synchronous hook to pendingHooks (gets removed instantly later)
21-
pendingHooks.add(transitionHook)
2222
// Assume hook executes synchronously and
2323
// automatically call the callback.
2424
callback()
2525
}
2626
}
2727

28-
if (hook.length >= asyncArity) {
29-
pendingHooks.add(transitionHook)
30-
}
28+
pendingHooks.add(transitionHook)
3129

3230
return transitionHook
3331
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"bugs": "https://github.com/ReactTraining/react-router/issues",
1717
"scripts": {
1818
"build": "npm run build-cjs && npm run build-es",
19-
"build-cjs": "rimraf lib && cross-env BABEL_ENV=cjs babel ./modules -d lib --ignore '__tests__'",
20-
"build-es": "rimraf es && cross-env BABEL_ENV=es babel ./modules -d es --ignore '__tests__'",
19+
"build-cjs": "rimraf lib && cross-env BABEL_ENV=cjs babel ./modules -d lib --ignore __tests__",
20+
"build-es": "rimraf es && cross-env BABEL_ENV=es babel ./modules -d es --ignore __tests__",
2121
"build-umd": "cross-env NODE_ENV=development webpack modules/index.js umd/ReactRouter.js",
2222
"build-min": "cross-env NODE_ENV=production webpack -p modules/index.js umd/ReactRouter.min.js",
2323
"lint": "eslint examples modules scripts tools *.js",

0 commit comments

Comments
 (0)