简体   繁体   English

如何在 prod 构建中包含 tsconfig.json?

[英]How to include tsconfig.json in prod build?

In tsconfig.json I included "resolveJsonModule": true .tsconfig.json我包含了"resolveJsonModule": true

Locally, when I start the app with npm run webpack:dev everything goes smoothly.在本地,当我使用npm run webpack:dev启动应用程序时,一切都很顺利。

However, while executing npm run webpack:prod it fails with: but '--resolveJsonModule' is not used.但是,在执行npm run webpack:prod它失败了: but '--resolveJsonModule' is not used.

So I guess the prod build doesn't take into account tsconfig file.所以我猜 prod 构建没有考虑tsconfig文件。

I believe the issue may lay somewhere in webpack.js files but I cannot find a specific place or variable.我相信问题可能出在webpack.js文件中的某个地方,但我找不到特定的位置或变量。

Here are the aliases for run builds:以下是运行构建的别名:

"webpack:dev": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --env.stats=minimal",
"webpack:dev-verbose": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --profile --progress --env.stats=normal",
"webpack:build:main": "npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal",
"webpack:build": "npm run cleanup && npm run webpack:build:main",
"webpack:prod:main": "npm run webpack -- --config webpack/webpack.prod.js --profile",
"webpack:prod": "npm run cleanup && npm run webpack:prod:main && npm run clean-www",
"webpack:test": "npm run test",
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"

Prod 构建使用tsconfig-aot.json正如您在webpack/webpack.prod.js看到的webpack/webpack.prod.js ,确保您也将"resolveJsonModule": true添加到此文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 tsconfig.json 包含属性 - tsconfig.json include property Angular CLI构建--prod失败,tsconfig.json“ noUnusedParameters” ser变为true,Angular Material - Angular CLI build --prod fails with tsconfig.json “noUnusedParameters” ser to true and Angular Material 如何配置 tsconfig.json 文件以包含角度库项目的 .ts 文件? - How to configure tsconfig.json file to include .ts files of an angular library project? 在 tsconfig.json 中包含多个 node_modules - include multiple node_modules in tsconfig.json tsconfig.json 的目的是什么? - what is the purpose of tsconfig.json? 如何在angular2项目中创建tsconfig.json文件? - How to create tsconfig.json file in angular2 project? 如何在tsconfig.json文件中为外部库配置路径属性 - How to configure paths property in tsconfig.json file for external libraries 如何在 tsconfig.json 中排除以“.spec.ts”结尾的文件 - How to exclude files ending in '.spec.ts' in tsconfig.json 在配置文件“ tsconfig.json”中找不到输入。 指定的“包含”路径在Angular 6中 - No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were in Angular 6 tsconfig.app.json中的baseUrl不会覆盖tsconfig.json中的baseUrl - baseUrl in tsconfig.app.json is not overiding the baseUrl in tsconfig.json
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM