Skip to content

Commit

Permalink
Import store modules with ES6 imports instead of dynamically (#3064)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue authored Jan 15, 2023
1 parent d8e6c3e commit a953142
Showing 1 changed file with 17 additions and 9 deletions.
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
}

0 comments on commit a953142

Please sign in to comment.