Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in constructRoutes when compiling typescript. #60

Closed
gjhommersom opened this issue Aug 26, 2020 · 4 comments
Closed

Error in constructRoutes when compiling typescript. #60

gjhommersom opened this issue Aug 26, 2020 · 4 comments

Comments

@gjhommersom
Copy link

Version: single-spa-layout@^1.0.0-beta.6:

Everything seems to be working fine but there is an error when compiling typescipt.

ERROR in C:/Git/tsc-single-spa-root/node_modules/single-spa-layout/dist/types/constructRoutes.d.ts(61,55):
TS2694: Namespace '"C:/Git/tsc-single-spa-root/node_modules/parse5/lib/index"' has no exported member 'DefaultTreeDocument'.
ERROR in C:/Git/tsc-single-spa-root/node_modules/single-spa-layout/dist/types/constructRoutes.d.ts(104,72):
TS2694: Namespace '"C:/Git/tsc-single-spa-root/node_modules/parse5/lib/index"' has no exported member 'DefaultTreeElement'.

This error is preventing the buildserver from running successfully because no errors are allowed.

@joeldenning
Copy link
Member

Hi @gjhommersom, could you check whether the following file exists in your node_modules: node_modules/@types/parse5/index.d.ts

If it doesn't exist, run npm install --save @types/parse5 and see if that fixes the error. The parse5 types are listed as a dependency of single-spa-layout, so I would expect them to already be there, but the stacktrace seems to indicate that they might not be there

@gjhommersom
Copy link
Author

I have done some digging around and I found the following:

node_modules\@types/parse5 exists and has version 5.0.3
node_modules\parse5 exists and has version 4.0.0

Versions of [email protected] are installed but always as nested dependencies. It does not exist in node_modules\single-spa-layout\node_modules.

I have resolved the issue by running yarn add parse5. This upgrades the version in node_modules\parse5 to the latest version.

My suspicion is that required version of parse5 should be added as a dependency. In beta-6 it is a dev-dependency and my guess that is the reason it is not installed. I see that this has been done in the latest source changes but those have not been released.

@joeldenning
Copy link
Member

joeldenning commented Sep 3, 2020

Thanks for the further investigation into this. The reason that the master branch has parse5 as a dependency is that it supports server-side rendering, whereas beta 6 does not. It is unreleased because it is unstable, although there's a chance I release beta 7 in the next few days. The parse5 dependency is not needed for browser-only projects, which is why it is a devDependency in beta 6. I added @types/parse5 to beta 6 as dependency to cover the typescript needs. It sounds like perhaps that isn't working, though. I don't use typescript in my projects that use single-spa-layout, which is why I haven't seen the issue. The easiest fix might be to publish beta 7 that includes parse5 as a dependency (even though that adds a massive number of bytes to the npm install that are completely unnecessary for browser usage of single-spa-layout)

@joeldenning
Copy link
Member

Closing due to inactivity, feel free to comment further / reopen if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants