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
[BUG] Compilation of Bokeh extension fails in the presence of a package.json file with type: module #13786
Labels
Comments
Update: I can reproduce without the
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Software versions
Python version : 3.12.2 (main, Feb 10 2024, 11:36:40) [Clang 14.0.3 (clang-1403.0.22.14.1)]
IPython version : (not installed)
Tornado version : 6.4
Bokeh version : 3.4.0
BokehJS static path : /Users/mdickinson/Desktop/.venv/lib/python3.12/site-packages/bokeh/server/static
node.js version : v20.11.1
npm version : 10.2.4
jupyter_bokeh version : (not installed)
Operating system : macOS-13.6.4-x86_64-i386-64bit
Browser name and version
Not applicable
Jupyter notebook / Jupyter Lab version
Not applicable
Expected behavior
I've been developing a Bokeh extension as part of a codebase that contains a mix of Python and JavaScript / TypeScript. We're using ES modules in preference to CommonJS modules for JavaScript, where possible.
When running an example Panel app that used the Bokeh extension the TypeScript compilation step for that extension was failing with an error ending with
Error: Cannot find module 'assert'
(full traceback below). I tracked the cause of this back to the use of"type": "module"
in mypackage.json
file.It turns out that a
package.json
file anywhere above the code being compiled has the same effect: I can install a working extension into a fresh .venv, see everything working as normal, then add apackage.json
file next to thatvenv
with the offending"type": "module"
declaration in it, and the Bokeh extension compilation now fails.Here are the steps I took. I regret that I'm not currently in a position to share the
panel_jsme
extension, but I suspect that the problem should be reproducible with any current TypeScript-using Bokeh extension module.python -m venv --clear .venv && source .venv/bin/activate
python -m pip install panel_jsme-1.1.0.dev1+gc3cb2e6-py3-none-any.whl
package.json
file next to the.venv
directory, withecho '{ "type": "module" }' > package.json
Observed behavior
After adding the extra
package.json
file next to the.venv
, when I launched the example application the browser showed an HTTP 500 error and the console showed a traceback.Example code
Stack traceback or browser console output
Console traceback ...
Screenshots
No response
The text was updated successfully, but these errors were encountered: