-
Notifications
You must be signed in to change notification settings - Fork 251
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
8.1.0 tsc errors #261
Comments
Hey @milesje, can you post here how you are importing Navigo. I mean the actual |
|
I just did a
And I get this in the browser console.
|
Are you using some sort of bundler like webpack? I want to replicate the issue on my machine so I can fix it. If you have time setting up an example repo will be the best. |
@milesje I managed to replicate the problem. Will provide a fix soon. |
I can upload my package.json file if that will help... but for running it on my PC it does not use a bundler it is using tsc to compile the TypeScript and then uses @web/dev-server to run the compiled code... package.json is attached as a zip file. |
Can you try version |
8.4.2 worked better I'm now only getting 2 errors
|
@krasimir attached is a simplified project that is setup almost identical to my project if you want something to test against. This is a open-wc project using LitElement and a mobx data store. |
so after applying the PR #264 I no longer get any tsc errors, but instead get an error in the browser console. |
@krasimir any ideas on the |
Thanks for the PR. Your change is released as |
Thanks for all the help.... I will continue to provide any PR for anything I find that I'm capable of fixing! |
Thanks. Also your navigo-test.zip is really useful. I hope I'll resolve this today. |
Let me know if there is anything I can help with.... |
So it looks like webpack is exporting UMD and AMD.... is there a way to get it to export a ESM set as well? I'm not sure why the UMD isn't working, but it might be easier to solve or at least workaround the issue would be to also export a ESM bundle or a CJS bundle. |
Yep. I'm preparing a ES build. |
Hm ... I just published
And still I'm getting:
Weird. I'll leave this for tomorrow morning. |
Thanks for the update and all the work! |
Hey @milesje, I think I've made some progress on the issue. It looks like the problem is in the web-dev-server. When I changed
So, I guess there is some tricky part and I'm not sure if the problem is in Navigo since it has now a ES version and that's what is getting used. |
I don't understand why 7.X works with the current configuration, but not 8.X. I'm 100% sure if is Navigo or some configuration on my part either. |
So with 8.4.4 and importing
|
I'm wondering if it has to do with the face that you define a class called Navigo (default export in index.d.ts) and then in index.ts you define a default export function called Navigo. I'm not the best at TypeScript or JavaScript, but this seems a little weird to me. Why not just declare the class in index.ts (instead of a function)? |
7.X was build and written in a different way. So I'm not surprised that version 8 works differently. As for the class vs function. At this point is not possible to go with a class since I used module-reveal pattern to write the library. Going with a class will mean rewriting everything and I'm a bit skeptical that this is the problem. Will investigate further. |
Is there a reason to use the module-reveal pattern versus using a class with private members and private functions? A little late now, but just curious.... |
@milesje back in the days when I started the library there was no classes :) So I decided to continue with the pattern that I used then. Also having a class added a few bytes to the transpiled version. |
@milesje I'm trying to run your example without Navigo. When I remove the import and clean up |
@krasimir sorry that issue is caused by an update to mobx. To fix it add the following to the index.html file the root directory.
|
@milesje I think I fixed it :) Can you try with the latest update |
@krasimir it does appear to be working... I'm going to run some more advanced scenarios to make sure everything is working... or at least the features I normally use anyway. Thanks a lot for all the hard work! I've really been enjoying this project and hope I can help some more on it. |
so I just did a small test to add a second route and something isn't working....
but when I click the help link I'm getting a 'Not Found' page instead of the expected HELP ME |
never mind.... now it is working as expected but I didn't really do anything other than add a 3rd .on and another href and now they are working as expected. |
Hello @milesje could you send here an example of how are you using Navigo 8 with WC? |
Upgraded from 7.1.2 to 8.1.0 and now I'm getting the following errors.
The text was updated successfully, but these errors were encountered: