Where to store and load custom application settings (js vs json)
-
I’d like to store my application settings in zSettings.js file which would stay readable after building an application.
I use static folder but I have a feeling that
export default
in combination withimport
always transpile my zSettings.js, so even I change the content it has no influance on application.// statics/zSettings.js const zSettings = { "API": "localhost" export default zSettings
In my .vue component:
import zSettings from "../statics/zSettings.js" // editable settings file
Could you help me how to treat custom settings inside .js files or should I keep my settings as .json (where I can not store my comments) and use Webpack with fs to copy it into statics?
Additional info: Documentation says that “files in
static/
are not processed by Webpack at all” but I found out that all my files are processed and compiled (.js files) into webpack files intodist/js
folder and copied tostatics
but settings are used from compileddist/js
folder. -
After three days of trying to find a way how to force webpack load .js file and not to compile it I gave up. Back to axios and json.