Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 爱奥尼亚2修改索引.html_Typescript_Ionic Framework_Ionic2 - Fatal编程技术网

Typescript 爱奥尼亚2修改索引.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')

我想在为开发或生产构建应用程序时修改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');
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”,