Access "fs" from boot file not working #17596
-
We have a folder structure for languages in
The plan is to grab the folder names and use them in our store. Quasar boot file "src\boot\init.ts":import { store } from 'src/store'
import fs from 'fs'
const directories = (source: string) =>
fs
.readdirSync(source, {
withFileTypes: true,
})
.filter((c) => c.isDirectory())
.map((c) => c.name)
console.log('dir list', directories('src/i18n')) This throws the following error:
In the Quasar config file docs it states: So I expected the boot file being able to access these folders or use the "fs" module in the context of Node. What is the correct way of retrieving the folder names and getting them in our store? Thank you for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
quasar.config file is a configuration file, which runs at build time So, the docs do not say you can use it in boot files. You just misinterpreted it. To achieve your goal, I see two options:
|
Beta Was this translation helpful? Give feedback.
quasar.config file is a configuration file, which runs at build time
Boot files are part of your application runtime code, so it runs in the browser
So, the docs do not say you can use it in boot files. You just misinterpreted it.
To achieve your goal, I see two options:
env
variable. Then, parse/use that env variable in your store.