Typescript 爱奥尼亚2修改索引.html
我想在为开发或生产构建应用程序时修改index.html文件 如果是生产,我需要注入一个Typescript 爱奥尼亚2修改索引.html,typescript,ionic-framework,ionic2,Typescript,Ionic Framework,Ionic2,我想在为开发或生产构建应用程序时修改index.html文件 如果是生产,我需要注入一个,如果是开发,我需要注入另一个 实际上我用这个--> 这是JS const rollupConfig = require('@ionic/app-scripts/config/rollup.config'); const replace = require('rollup-plugin-replace'); const isProd = (process.env.IONIC_ENV === 'prod')
,如果是开发,我需要注入另一个
实际上我用这个-->
这是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;
谢谢您需要以不同的方式调用build以使用汇总配置:
“构建”:“爱奥尼亚应用程序脚本构建——汇总。/config/rollup.config.js”,