TypeError: Cannot read property 'content' of undefined

青春壹個敷衍的年華 提交于 2021-02-08 07:56:39

问题


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"
};

回答1:


It seems that on production build, its skipped files containing dot .env.. so I removed the dot env and everything got back to normal



来源:https://stackoverflow.com/questions/45808908/typeerror-cannot-read-property-content-of-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!