2
我想修改我的index.html文件,當我構建我的應用程序進行開發或生產時。Ionic 2修改Index.html
我需要注入一個<script>
如果是生產等<script>
如果是發展
其實我用這個---> https://github.com/driftyco/ionic-app-scripts
而且這個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;
感謝