Ada*_*all 5 angular tailwind-css nrwl-nx
The documentation here: https://nx.dev/l/r/guides/using-tailwind-css-in-react#introducing-nx-utility-for-better-tailwind-purging suggests to use createGlobPatternsForDependencies(__dirname)
for ease of maintenance.
I am using this from '@nrwl/angular/tailwind', not '@nrwl/react/tailwind'.
When I use this and trigger a build of my app, I get the following errors:
[createGlobPatternsForDependencies] WARNING: There was no ProjectGraph available to read from, returning an empty array of glob patterns
Q: How can I resolve this?
I can run nx dep-graph
and the dependency graph generates fine.
编辑:我调试了这个,__dirname
文档说工作区相对目录路径将用于推断父项目和依赖项
,但随后在第 20 行失败,generate-globs.js
因为filenameRelativeToWorkspaceRoot
是 '',即它试图查找项目名称,但__dirname
它是工作区名称本身?
所以
purge: createGlobPatternsForDependencies(join(__dirname, 'apps/simple-app')),
不会给出 ProjectGraph 错误,但是
purge: createGlobPatternsForDependencies(__dirname),
做
我还在 Github 上发帖,提出了 Nx 文档基于 React 的问题。
自从我提出这个问题以来,已经写了一篇博客文章:https://blog.nrwl.io/set-up-tailwind-css-with-angular-in-an-nx-workspace-6f039a0f4479
文档位于 Nx 网站上:https ://nx.dev/guides/using-tailwind-css-with-angular-projects
但关键的学习是每个应用程序都有一个单独的 Tailwind 配置文件。
你可以有一个共享 Tailwind 配置的预设并使用它,但createGlobPatternsForDependencies
期望是每个应用程序,所以__dirname
项目名称更有意义......
如果此时您仍然得到[createGlobPatternsForDependencies] WARNING: There was no ProjectGraph available to read from, returning an empty array of glob patterns
,那么可能存在循环依赖关系,阻止代码执行,可以调试node_modules/@nrwl/angular/tailwind.js
中的文件来查看。
归档时间: |
|
查看次数: |
2722 次 |
最近记录: |