admin管理员组文章数量:1353186
When building my NX Angular application I include **/env**.ts
in tsconfig.app.json. I do this to compile all env files. However I determine which ones will be used in webpack.config.ts. I add files like env.qa.ts as entry points depending on some logic. So basically I don't know what env.x.ts will or will not be part of the build until webpack does its work. This leads to the warning, "is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig."
I can't simply exclude the env files as I don't know which ones I will need until webpack completes. My project actually has hundreds of env.ts files, so this warning comes up a lot. Please let me know if there is some way to suppress this warning.
I tried setting warnings to false in webpack config.stats.warnings. That didn't work. I can't seem to find a suppression flag or a work around.
tsconfig.app.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["node", "jest"],
"target": "ES2022",
"useDefineForClassFields": false
},
"files": ["src/main.ts", "src/polyfills.ts"],
"include": ["**/*.d.ts", "**/env**.ts"],
"exclude": ["**/*.spec.ts", "**/*.mock.ts", "**/e2e", "**/testing", "jest.config.ts"]
}
本文标签:
版权声明:本文标题:webpack - How can I suppress the warning Add only entry points to the 'files' or 'include' prope 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743923065a2562451.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论