ng-doc: [Bug] Strange behavior on ng-doc 16.3.2
Is this a regression?
Yes
Description
I’m upgrading to 16.3.2 from Angular 15. It’s gone well so far, but I’m noticing a strange issue when building using webpack.
If I build first using webpack, the ng-doc folder isn’t generated properly. It’s missing all of the pages under guides. Example:
./.ng-doc/app/ng-doc.routing.ts:3:22-70 - Error: Module not found: Error: Can't resolve '.ng-doc/app/guides/installation/module' in '/Users/rbower/code/qc/qui/qui-components/packages/angular-docs/.ng-doc/app'
./.ng-doc/app/ng-doc.routing.ts:6:22-57 - Error: Module not found: Error: Can't resolve '.ng-doc/app/guides/module' in '/Users/rbower/code/qc/qui/qui-components/packages/angular-docs/.ng-doc/app'
It works when I use the esbuild builder. However, I need to use the webpack builder because tailwind + scss isn’t currently supported, and my docs site uses tailwind for demos.
What’s weird is that when I build using esbuild and then switch over to webpack and build, it works just fine, even if I clear the .ng-doc folder between builds.
Please provide the exception or error you saw
./.ng-doc/app/ng-doc.routing.ts:3:22-70 - Error: Module not found: Error: Can't resolve '.ng-doc/app/guides/installation/module' in '/Users/rbower/code/qc/qui/qui-components/packages/angular-docs/.ng-doc/app'
./.ng-doc/app/ng-doc.routing.ts:6:22-57 - Error: Module not found: Error: Can't resolve '.ng-doc/app/guides/module' in '/Users/rbower/code/qc/qui/qui-components/packages/angular-docs/.ng-doc/app'
### OS
Unix (Linux, macOS, etc.)
### Browser
Chrome
### Node version
18.16.0
### Anything else?
_No response_
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 24 (12 by maintainers)
Commits related to this issue
- chore(release): 16.5.0-beta.1 [skip ci] # [16.5.0-beta.1](https://github.com/ng-doc/ng-doc/compare/v16.4.3...v16.5.0-beta.1) (2023-06-09) ### Bug Fixes * **builder:** anchor is removed for external... — committed to ng-doc/ng-doc by semantic-release-bot a year ago
- chore(release): 16.5.0 [skip ci] # [16.5.0](https://github.com/ng-doc/ng-doc/compare/v16.4.3...v16.5.0) (2023-06-09) ### Bug Fixes * **builder:** anchor is removed for external links ([f0a62b4](htt... — committed to ng-doc/ng-doc by semantic-release-bot a year ago
@R-Bower it’s not reproducible in my new branch, so maybe I’ve already fixed it 🙃 I want to test a new feature and changes that I’ve done and release them tomorrow, so let’s wait a bit 😃
Anytime, happy to help!
Awesome! Then I will merge the changes, and release them together with the next version. But I think let this feature be turned off by default for now, if there are no other problems with it in the future, then I will turn it on. Thanks a lot for the feedback! 👍
So far I’ve tested the following:
Everything seems to be working as expected. Hot reloading is also working.
I can get caching to work in dev mode by following these steps:
cache: falseinng-doc.config.tscache: trueinng-doc.config.tsIt’s quite fast. Looking forward to when this is fixed 😃
Got it, thank you 👍 I’ll continue checking 🤔
The reason that the project was built correctly after switching the builder is that NgDoc resets the cache after changing the configuration, so I decided to disable the cache function by default, I have not yet been able to reproduce a similar problem on other projects, apparently, its stability depends on the environment. It seems that the only way to solve it is to get a project in which it is reproduced so that it would be possible to debug its behavior and understand what’s going on.
I’m also gonna refactor the builder, reduce the delay between the NgDoc and Angular builders, and maybe slightly increase the build speed, so maybe this problem will go away by itself, anyway will see!
Cool, thanks for the quick response!
@R-Bower ok great I think we’ve found the problem, I specifically made it so that the cache could be completely disabled by returning to the process as it was before the cache in case something like this happens, because the cache is quite a big feature and most likely will not work correctly on all projects from the start. I’ll try to reproduce this locally and fix it, thank you for the feedback!