Created
August 21, 2023 21:37
-
-
Save nkreiger/f5d0ce20a98fb8e0161b4750f3bb4f46 to your computer and use it in GitHub Desktop.
This file contains 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
`public/config.js` | |
const config = (() => { | |
return { | |
"TEST_ONE": "hello", | |
"TEST_TWO": "world" | |
}; | |
})(); | |
`src/index.template.html` | |
<script src="config.js"></script> | |
`.eslintrc.js` | |
config: 'readable' | |
}, | |
`.quasar.conf.js` | |
// https://quasar.dev/quasar-cli/handling-webpack | |
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain | |
chainWebpack (chain) { | |
chain.module | |
.rule('custom-config') | |
.test(/config.*config\.js$/) | |
.use('file-loader') | |
.loader('file-loader') | |
.options({ | |
name: 'config.js' | |
}); | |
chain.plugin('eslint-webpack-plugin') | |
.use(ESLintPlugin, [{ extensions: [ 'js', 'vue' ] }]) | |
}, | |
`src/boot/env.js` | |
export const TEST_ONE = config.TEST_ONE | |
export const TEST_TWO = config.TEST_TWO | |
folder structure | |
src | |
boot | |
env.js | |
index.template.html | |
public | |
config.js | |
.eslintrc.js | |
Now you can use it anywhere :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment