Last active
September 6, 2019 09:59
-
-
Save ntnyq/9ccbbcdf680d9ef637fae8743595bf61 to your computer and use it in GitHub Desktop.
[Webpack tricks] #Webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const files = require.context('.', true, /models\/[^/]+\.js$/) | |
files.keys().forEach(key => { | |
module.exports[key.replace(/\.\/models\/|\.js/g, '')] = files(key).default | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment