title: Ionic 2 modify Index.html
body: <p>I want to modify my index.html file when I build my app for development or production.</p>
  
  <p>I need to inject one <code>&lt;script&gt;</code> if is production and other <code>&lt;script&gt;</code> if is development</p>
  
  <p>Actually I use this  --->
  <a href="https://github.com/driftyco/ionic-app-scripts" rel="nofollow noreferrer">https://github.com/driftyco/ionic-app-scripts</a></p>
  
  <p>And this JS</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>Thanks </p>