[🚑] Fixed plugins not loading

This commit is contained in:
ThinLiquid 2023-10-18 02:27:17 +01:00
parent f3327d75cd
commit 7702f2728e
No known key found for this signature in database
GPG key ID: D5085759953E6CAA
4 changed files with 30 additions and 8 deletions

19
package-lock.json generated
View file

@ -21,6 +21,7 @@
"ts-standard": "^12.0.2", "ts-standard": "^12.0.2",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vite": "^4.4.11", "vite": "^4.4.11",
"vite-plugin-dynamic-import": "^1.5.0",
"vite-plugin-node-polyfills": "^0.15.0" "vite-plugin-node-polyfills": "^0.15.0"
} }
}, },
@ -1927,6 +1928,12 @@
"safe-array-concat": "^1.0.1" "safe-array-concat": "^1.0.1"
} }
}, },
"node_modules/es-module-lexer": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.1.tgz",
"integrity": "sha512-JUFAyicQV9mXc3YRxPnDlrfBKpqt6hUYzz9/boprUJHs4e4KVr3XwOF70doO6gwXUor6EWZJAyWAfKki84t20Q==",
"dev": true
},
"node_modules/es-set-tostringtag": { "node_modules/es-set-tostringtag": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz",
@ -5930,6 +5937,18 @@
} }
} }
}, },
"node_modules/vite-plugin-dynamic-import": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.5.0.tgz",
"integrity": "sha512-Qp85c+AVJmLa8MLni74U4BDiWpUeFNx7NJqbGZyR2XJOU7mgW0cb7nwlAMucFyM4arEd92Nfxp4j44xPi6Fu7g==",
"dev": true,
"dependencies": {
"acorn": "^8.8.2",
"es-module-lexer": "^1.2.1",
"fast-glob": "^3.2.12",
"magic-string": "^0.30.1"
}
},
"node_modules/vite-plugin-node-polyfills": { "node_modules/vite-plugin-node-polyfills": {
"version": "0.15.0", "version": "0.15.0",
"resolved": "https://registry.npmjs.org/vite-plugin-node-polyfills/-/vite-plugin-node-polyfills-0.15.0.tgz", "resolved": "https://registry.npmjs.org/vite-plugin-node-polyfills/-/vite-plugin-node-polyfills-0.15.0.tgz",

View file

@ -18,6 +18,7 @@
"ts-standard": "^12.0.2", "ts-standard": "^12.0.2",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vite": "^4.4.11", "vite": "^4.4.11",
"vite-plugin-dynamic-import": "^1.5.0",
"vite-plugin-node-polyfills": "^0.15.0" "vite-plugin-node-polyfills": "^0.15.0"
}, },
"dependencies": { "dependencies": {

View file

@ -3,12 +3,12 @@ import { StatusItem } from './types'
class StatusBar { class StatusBar {
pluginList: string[] = [ pluginList: string[] = [
'./modules/appLauncher.ts', 'appLauncher',
'./modules/apps.ts', 'apps',
'./modules/weather.ts', 'weather',
'./modules/clock.ts', 'clock',
'./modules/switcher.ts', 'switcher',
'./modules/battery.ts' 'battery'
] ]
plugins: StatusItem[] = [] plugins: StatusItem[] = []
@ -40,7 +40,7 @@ class StatusBar {
window.preloader.setStatus('importing default plugins...') window.preloader.setStatus('importing default plugins...')
for (const pluginPath of this.pluginList) { for (const pluginPath of this.pluginList) {
const plugin = await import(pluginPath) const plugin = await import(`./modules/${pluginPath}.ts`)
window.preloader.setStatus(`importing default plugins\n${pluginPath}`) window.preloader.setStatus(`importing default plugins\n${pluginPath}`)
this.add(plugin) this.add(plugin)

View file

@ -1,8 +1,10 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills' import { nodePolyfills } from 'vite-plugin-node-polyfills'
import dynamicImport from 'vite-plugin-dynamic-import'
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
nodePolyfills() nodePolyfills(),
dynamicImport()
] ]
}) })