Hello. I want to modify my index.html file when I build my app for development or production.
I need to inject one if is production and other if is development
Actually I use this —>
And this JS
const rollupConfig = require('@ionic/app-scripts/config/rollup.config');
const replace = require('rollup-plugin-replace');
const isProd = (process.env.IONIC_ENV === 'prod');
console.log('✓ ENVIRONMENT IS PRODUCTION: ', isProd);
const rollupConfigReplaceEnviroment = replace({
exclude: 'node_modules/**',
// use the /environments/environment.dev as the default import(!), no stub needed.
// note we only replace the "last" part of the import statement so relative paths are maintained
'/environments/environment.dev' : ( isProd ? '/environments/environment.prod' : '/environments/environment.dev'),
});
rollupConfig.plugins = rollupConfig.plugins || [];
rollupConfig.plugins.splice(0, 0, rollupConfigReplaceEnviroment);
module.exports = rollupConfig;
Thanks