Created
April 14, 2018 23:58
-
-
Save mlynarczyk/2ae02bd134fd613ae836c29e2a0a76df to your computer and use it in GitHub Desktop.
webpack import components directory
This file contains hidden or 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 viewsContext = require.context('./views', false, /\.vue$/); | |
| let views = {}; | |
| viewsContext.keys().forEach((key) => { | |
| const name = viewsContext(key).default.name; | |
| views[name] = viewsContext(key).default; | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dont use in files you gonna test, you either gonna have to mock or polyfill