From 2566834774bd1d82bb4f67bb5664a5604a151bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=9B=86=E9=B9=84?= Date: Thu, 25 Jan 2018 10:01:13 +0800 Subject: [PATCH] Simplify the code and update the comments (#809) https://webpack.github.io/docs/context.html The webpack 1.x documentation was deleted. --- src/models/index.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/models/index.js b/src/models/index.js index 36666147..049c0149 100644 --- a/src/models/index.js +++ b/src/models/index.js @@ -1,11 +1,4 @@ // Use require.context to require reducers automatically -// Ref: https://webpack.github.io/docs/context.html +// Ref: https://webpack.js.org/guides/dependency-management/#require-context const context = require.context('./', false, /\.js$/); -const keys = context.keys().filter(item => item !== './index.js'); - -const models = []; -for (let i = 0; i < keys.length; i += 1) { - models.push(context(keys[i])); -} - -export default models; +export default context.keys().filter(item => item !== './index.js').map(key => context(key)); -- GitLab