-
Notifications
You must be signed in to change notification settings - Fork 355
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
Vite fails on module specifiers when importing Plugin class #3221
Comments
Hi @Laurelin, this is related to the build/bundling environment you're working on. I'm not sure the cause, but from the err message the import Plugin from 'billboard.js/src/plugin/Plugin.js'; // or Plugin.ts If you can provide reproducible example will help to dig in more. |
Hello! That import line fails to resolve in vite. It's because your package.json exports don't specify it :
none of those refer to a /src/plugin. When add this to the exports:
Vite resolves the plugin fine. I'm not quite sure on etiquette here; I can fork and make a PR for this. I'm also not sure if this does something that you all don't want happening. In particular, I notice that all the types on the Plugins are 'any' because ChartInternal is private(ish?) and none of the types it uses are exported. So while I know that this.$$ in a plugin is a ChartInternal object, I have to mark it as an 'any' and can't rely on typescript hints to see what I can do with it. Are these things supposed to be public? Am I supposed to be developing plugins as a fork of billboard.js itself? |
@Laurelin, thanks for the comment. There're no needs from the user perspective to import each files from "exports": {
...
"./src/Plugin/Plugin.js": "./src/Plugin/Plugin.js"
}, Can you make a PR for this? |
Fix Plugin class to be imported from the npm package module. Ref naver#3221
# [3.9.0-next.1](3.8.2...3.9.0-next.1) (2023-06-15) ### Bug Fixes * **export:** Fix Plugin class import ([24c0976](24c0976)), closes [#3221](#3221) * **shape:** Fix shape rendering issue on Windows ([cf1b484](cf1b484)), closes [#3222](#3222) * **tooltip:** Fix tooltip overflow when right side edge is hovered ([9ce900d](9ce900d)), closes [#3254](#3254) ### Features * **arc:** Intent to ship arc.needle ([04e90aa](04e90aa)), closes [#3205](#3205) * **data:** Intent to ship data.labels.position function ([59be3ec](59be3ec)), closes [#3237](#3237) * **module:** Support dual CJS/ESM package ([437c007](437c007)), closes [#2202](#2202) * **plugin:** Intent to ship TableView plugin ([215b611](215b611)), closes [#1873](#1873) * **theme:** Intent to ship dark theme ([252a28e](252a28e)), closes [#3229](#3229)
# [3.9.0](3.8.2...3.9.0) (2023-07-03) ### Bug Fixes * **export:** Fix Plugin class import ([24c0976](24c0976)), closes [#3221](#3221) * **shape:** Fix shape rendering issue on Windows ([cf1b484](cf1b484)), closes [#3222](#3222) * **tooltip:** Fix tooltip overflow when right side edge is hovered ([9ce900d](9ce900d)), closes [#3254](#3254) ### Features * **arc:** Intent to ship arc.needle ([04e90aa](04e90aa)), closes [#3205](#3205) * **bar:** Intent to ship bar.front ([f7e0d80](f7e0d80)), closes [#2965](#2965) * **data:** Intent to ship data.labels.position function ([59be3ec](59be3ec)), closes [#3237](#3237) * **legend:** Intent to ship legend.item.interaction.dblclick ([18f5c4a](18f5c4a)), closes [#1404](#1404) * **legend:** Intent to ship legent.item.interaction ([af87d10](af87d10)), closes [#1598](#1598) * **point:** Enhance point.sensitivity ([a537201](a537201)), closes [#2568](#2568) * **theme:** Intent to ship dark theme ([252a28e](252a28e)), closes [#3229](#3229)
Description
I'm attempting to build a plugin for my app using Typescript. It looks great in my code editor, but it fails on vite:import-analysis because the base class for plugins is not included in the module specifiers. I'm using Nuxt 3.
I can see and click into the Plugin class from intellisense and node_modules. It's there, but vite fails it.
Steps to check or reproduce
run the nuxt dev command in terminal
ERROR Internal server error: Missing "./src/plugin/Plugin" specifier in "billboard.js" package
Plugin: vite:import-analysis
The text was updated successfully, but these errors were encountered: