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

panel compile <path> error: Could not resolve "./Calendar" #7583

Closed
ahuang11 opened this issue Jan 4, 2025 · 6 comments
Closed

panel compile <path> error: Could not resolve "./Calendar" #7583

ahuang11 opened this issue Jan 4, 2025 · 6 comments

Comments

@ahuang11
Copy link
Contributor

ahuang11 commented Jan 4, 2025

I wanted to compile: https://github.com/panel-extensions/panel-full-calendar/tree/main

panel compile src/panel_full_calendar/main.py
Running command: npm install

npm output:

added 7 packages, and audited 8 packages in 2s

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities

An error occurred while running esbuild: ✘ [ERROR] Could not resolve "./Calendar"

    index.js:1:26:
      1 │ import * as Calendar from "./Calendar"~~~~~~~~~~~~
@philippjfr
Copy link
Member

philippjfr commented Jan 4, 2025

Try using the --build-dir option as described here. https://panel.holoviz.org/how_to/custom_components/esm/build.html#using-the-build-dir-option

@ahuang11
Copy link
Contributor Author

ahuang11 commented Jan 6, 2025

Not sure if I'm using it correctly:

panel compile src/panel_full_calendar/main.py --build-dir src/
Running command: npm install

npm output:

added 7 packages, and audited 8 packages in 213ms

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities

An error occurred while running esbuild: ✘ [ERROR] Could not resolve "./Calendar"

    index.js:1:26:
      1import * as Calendar from "./Calendar"~~~~~~~~~~~~

1 error

@philippjfr
Copy link
Member

The point was for you to be able to debug it by inspecting the contents of the build_dir.

@philippjfr
Copy link
Member

For a package you should really ask it to compile the dotted module paths (panel compile panel_full_calendar or panel compile panel_full_calendar.main, since it won't be able to correctly resolve other modules if you use a regular path. Will close for the time being.

@ahuang11
Copy link
Contributor Author

Oh, magically it worked this time

panel compile src/panel_full_calendar/main.py --build-dir src/
Building /Users/ahuang/repos/panel-full-calendar/src/panel_full_calendar/Calendar.bundle.js containing the following components:

- Calendar

Running command: npm install

npm output:

added 7 packages, and audited 8 packages in 2s

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities

esbuild output:

  panel_full_calendar/Calendar.bundle.js  180.3kbDone in 17ms

But now I'm wondering, what do I do with this Calendar.bundle.js when I publish to PyPI? Do I need to add it to MANIFEST.in?

@philippjfr
Copy link
Member

But now I'm wondering, what do I do with this Calendar.bundle.js when I publish to PyPI? Do I need to add it to MANIFEST.in?

I think MANIFEST.in is no longer needed with modern build tools, should be included by default by hatch I think, but try it and confirm.

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