Update the insert configuration to get the configuration file name at run time, not hardcoded

I use wbepack and try to be more dynamic with the settings in mine when creating my application. This is a project create-react-appthat has been thrown away.

For example, if I want to create a local assembly in my file package.json, I have the following.

"build:local": "APPLICATION_ENV=local npm run build",

I would like to have a custom assembly where I can transfer a file to json, which this config will then use.

"custom": "APPLICATION_ENV=custom CUSTOM_ENV=test.json npm run build",

I think it would be normal to make this work, but still I can write the name of the dynamic json file so that I can decide which json file to use and not hardcode it in mine package.json.

in my head something like this:

npm run build:custom CUSTOM_CONFIG=hulkhogan.json

Does anyone know how to approach this? Maybe something like this .

+4
source share
1 answer

Check out https://www.npmjs.com/package/better-npm-run may be useful for this.

+2
source

Source: https://habr.com/ru/post/1681858/


All Articles