-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Relativize module paths in the emitted js/d.ts files #8782
Conversation
84c9513
to
f59c20b
Compare
f59c20b
to
1fa5e09
Compare
I built this branch and locally installed bokehJS as a package in a local package. I can verify that bokehJS now imports successfully without throwing relative path errors. Thank you |
After further experimentation, I think I found some bugs with this. I'm working on an example project that will demonstrate the difficulty that I am having. |
I created bokehjs-npm-example. bokehjs-npm-example has build instructions, I'm happy to turn that repo into documentation for bokeh. I started with the 8197_relative branch and added the following two lines to bokehjs/src/lib/index.ts .
This gets the bokehjs API into the npm module. I'm happy to create a pull request for this, but I'm not sure how a PR on a PR works. I'm also not sure if this adds the API to every bokeh artifact. I would think that you would want the API to be a part of the npm module. When running the application (with code pulled from the bokehjs documentation), I get the following error
This corresponds with
in bokehjs/src/lib/core/util/spatial.ts I will dig around and see if I can figure anything obvious out. Let me know if there are any fixes that I can help with. |
After more research, this seems to be related to the module type. BokehJS currently uses commonJS, npm seems to want es6 modules. The whole build system for bokehJS is complicated and hard to follow. Could you give an overview of the intentions of the bokehJS setup. I'm working to become more familiar with typescript build setups and npm packaging in general. When looking at this project with an aim toward contributing, I have to work through the following steps for each change
In my view better understanding 4 is the biggest missing part from the bokeh team. The rest (especially 1 and 2) I should be able to figure out myself. Thoughts? |
@bryevdv, I think this PR can be considered to be merged for 1.1. I did some additional testing on Windows to make sure we don't regress there. I also have code for bringing this functionality under test (issue #6389), but due to unreliability of npm cli commands, I will have to put some work into that. |
That's typescript. This gets translated to |
My mistake in reporting the error. The error doesn't come from the call to Here is the code as built. The following javascript code would work without an error
|
Success!!
This results in typescript errors on compile but the built npm package does work properly when installed. I would think you want to implement a different fix for this. The important part is that, we are really close to having a functioning npm module. |
The underlying problem is that flatbush uses an experimental
For rollup etc. similar configuration option should be hopefully possible. |
I created issue #8801 for the ESM support discussion (which is unrelated to the substance of this PR). |
fixes #8197
fixes #6513