I have to include web.config file to specify some behavior for static files on Azure hosting. I added file under /src folder in Ionic 3 application, but I can’t see it in platforms/browser/www in the end.
Is there workaround for this ?
I have to include web.config file to specify some behavior for static files on Azure hosting. I added file under /src folder in Ionic 3 application, but I can’t see it in platforms/browser/www in the end.
Is there workaround for this ?
Is it a must to have this file at the root www of your app?
If no, couldn’t you drop it into src/assets (deployed to www/assets)?
It must be in root only.
Oki doki, then you could maybe achieve what you want by overriding the config of ionic-app-scripts
For example (I would suggest to try)
1-Overwrite locally copy.config.js
from app-scripts respectively do a local copy of https://github.com/ionic-team/ionic-app-scripts/blob/master/config/copy.config.js
2-Add your web.config
file to the list of files of the property (inside copy.config.js)copyIndexContent
3-In your package.json
specifiy where your local config is, like for example
"config": {
"ionic_copy": "./scripts/copy.config.js"
"ionic_source_map_type": "source-map"
}
If you do so, don’t forget time to time, when you upgrade app-scripts, if they made changes in the file you would have override to copy the changes locally too.
That’s really nice start of a day
Thank you so much !
You’re welcome, glad to hear it worked out
One more question is it possible in your solution to use a condition to allow external configuration:
"ionic_copy": "./scripts/copy.config.js"
only when IONIC_ENV === 'prod'
: npm run ionic:build --prod
Honestly, I don’t know.
After I read your question I went to the README of app-scripts and found the following, maybe it’s something you could analyze deeper
Command-line Flags
Remember how we’re actually running ionic-app-scripts from the scripts property of a project’s package.json file? Well we can also add command-line flags to each script, or make new scripts with these custom flags. For example:“scripts”: {
“build”: “ionic-app-scripts build --webpack ./config/webpack.dev.config.js”,
“minify”: “ionic-app-scripts minify --cleancss ./config/cleancss.config.js”,
},
The same command-line flags can be also applied to npm run commands too, such as:npm run build --webpack ./config/webpack.dev.config.js
Thanks for the idea! My final solution is following:
I added configuration file to ./config/copy.config.js
and instead of referencing it in package.json
, I injected command line parameter for production builds:
npm run ionic:build --prod --copy ./config/copy.config.js