Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import store modules with ES6 imports instead of dynamically #3064

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions src/renderer/store/modules/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
/**
* The file enables `@/store/index.js` to import all vuex modules
* in a one-shot manner. There should not be any reason to edit this file.
* in a one-shot manner.
*/

const files = require.context('.', false, /\.js$/)
const modules = {}
import history from './history'
import invidious from './invidious'
import playlists from './playlists'
import profiles from './profiles'
import settings from './settings'
import subscriptions from './subscriptions'
import utils from './utils'

files.keys().forEach(key => {
if (key === './index.js') return
modules[key.replaceAll(/(\.\/|\.js)/g, '')] = files(key).default
})

export default modules
export default {
history,
invidious,
playlists,
profiles,
settings,
subscriptions,
utils
}