I have a config file throwing error when only building with AOT ionic cordova build android --prod
Error: ./src/config/.env.ts Module build failed: TypeError: Cannot read property 'content' of undefined at Object.optimizationLoader (/Users/yasir/myApp/mobile/node_modules/@ionic/app-scripts/dist/webpack/optimization-loader-impl.js:14:24) at Object.loader (/Users/yasir/myApp/mobile/node_modules/@ionic/app-scripts/dist/webpack/optimization-loader.js:5:32) @ ./src/providers/post-service.js 15:0-40 @ ./src/app/app.module.ngfactory.js @ ./src/app/main.ts
This is the content of the .env.ts file. The file is inside src .src/config/.env.ts
export const config: any = {
serverUrl: "http://0.0.0.0:3000"
};
post-service.ts? - Sampath.envfile is imported...and its imported in all the services obviously.. the following is the simplest format of how I am using the.envfile:import { config } from '../config/.env';`export class PostService { serverUrl = config.serverUrl; } - Yasirserveand build without AOT... perhaps the way I am exportingconfigas shown above... or if you suggest other ways to achieve the same purpose - Yasir