TypeError:无法读取未定义的属性“内容" [英] TypeError: Cannot read property 'content' of undefined
问题描述
当仅使用AOT构建时,我有一个配置文件抛出错误. ionic cordova build android --prod
I have a config file throwing error when only building with AOT ionic cordova build android --prod
错误:./src/config/.env.ts模块构建失败:TypeError:无法在Object.optimizationLoader读取未定义的属性"content"(/Users/yasir/myApp/mobile/node_modules/@ionic/app-scripts/dist/webpack/optimization-loader-impl.js:14:24)在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
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
这是 .env.ts
文件的内容.该文件位于src .src/config/.env.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"
};
推荐答案
似乎在生产版本中,其跳过的文件包含 dot
.env
..所以我删除了点 env
,一切恢复正常
It seems that on production build, its skipped files containing dot
.env
.. so I removed the dot env
and everything got back to normal
这篇关于TypeError:无法读取未定义的属性“内容"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!