描述bug
运行Angular的Storybook。我有一个包含solution-style
设置的tsconfig项目。但是在运行storybook时,会出现一堆警告:
6% setup before compile angular-compiler<i> [webpack-dev-middleware] wait until bundle finished
Warning: The inferred tsconfig file "/Users/**/Documents/git/storybook-playground/tsconfig.json" appears to be "solution-style" since it contains no root files but does contain project references.
This is probably not wanted, since ngcc is unable to infer settings like "paths" mappings from such a file.
Perhaps you should have explicitly specified one of the referenced projects using the --tsconfig option. For example:
ngcc ... --tsconfig "./tsconfig.app.json"
ngcc ... --tsconfig "./tsconfig.ide.json"
ngcc ... --tsconfig "./tsconfig.spec.json"
Find out more about solution-style tsconfig at https://devblogs.microsoft.com/typescript/announcing-typescript-3-9/#solution-style-tsconfig.
If you did intend to use this file, then you can hide this warning by providing it explicitly:
ngcc ... --tsconfig "tsconfig.json"
我不理解的是,为什么Storybook会捕获到那个tsconfig文件,因为我已经在.storybook
文件夹中配置了使用tsconfig.json
的设置。而且这个tsconfig是基于根目录中的tsconfig.app.json
。
"storybook": {
"builder": "@storybook/angular:start-storybook",
"options": {
"tsConfig": ".storybook/tsconfig.json", <------ NOTICE
"browserTarget": "storybook-playground:build:production",
"port": 6006
}
},
为什么我还会有这样的日志记录?
重现问题
https://github.com/evtk/storybook-playground
系统信息
Environment Info:
System:
OS: macOS 13.0.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.18.0 - /opt/homebrew/opt/node@16/bin/node
npm: 8.19.2 - /opt/homebrew/opt/node@16/bin/npm
Browsers:
Chrome: 107.0.5304.121
Safari: 16.1
其他上下文
- 无响应*
3条答案
按热度按时间bxgwgixi1#
你好,@evtk。我查看了read.me文件。
https://github.com/storybookjs/storybook/blob/next/code/frameworks/angular/README.md
选项tsconfig对于storybook或build-storybook配置来说都是无效的。
如果我能找到一种方法来实现这个功能,我会回来告诉你的。
mfpqipee2#
hi @evtk just add this to .storybook/main.js
"typescript": { check: true, checkOptions: { tsconfig: "./tsconfig.json" } } }
Source: https://storybook.js.org/docs/angular/configure/typescript
ekqde3dh3#
你好,@eBitzu ,感谢你的关注。我刚刚尝试了你建议的修复方法,但是警告仍然存在。