-
Notifications
You must be signed in to change notification settings - Fork 28
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
Update package.json #27
Conversation
There is an issue when trying to use this with vite-ssg: ``` [vite-ssg] An internal error occurred. [vite-ssg] Please report an issue, if none already exists: https://github.com/antfu/vite-ssg/issues file:///Users/mykolas/Documents/Projects/the_cheat/.vite-ssg-temp/main.mjs:29 import hljsVuePlugin from "@highlightjs/vue-plugin"; ^^^^^^^^^^^^^ SyntaxError: The requested module '@highlightjs/vue-plugin' does not provide an export named 'default' at ModuleJob._instantiate (node:internal/modules/esm/module_job:127:21) at async ModuleJob.run (node:internal/modules/esm/module_job:193:5) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:337:24) at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15) at async build (/Users/mykolas/Documents/Projects/the_cheat/node_modules/.pnpm/vite-ssg@0.17.10_2a1f4eb68d7efe0f1402d91afc414ace/node_modules/vite-ssg/dist/node/cli.cjs:180:87) at async Object.handler (/Users/mykolas/Documents/Projects/the_cheat/node_modules/.pnpm/vite-ssg@0.17.10_2a1f4eb68d7efe0f1402d91afc414ace/node_modules/vite-ssg/dist/node/cli.cjs:314:3) ``` Adding these exports fixes it.
package.json
Outdated
"import": "./dist/highlightjs-vue.esm.min.js", | ||
"types": "./dist/vue.d.ts" | ||
}, | ||
"./*": "./*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this line necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a last resort, package encapsulation can be disabled entirely by creating an export for the root of the package "./*": "./*". This exposes every file in the package at the cost of disabling the encapsulation and potential tooling benefits this provides.
I'm not sure to understand why we need it, @Neophen can you elaborate ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry that is not neccasary :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove i& it's not necessary.
Co-authored-by: Samuel MARLHENS <11817371+smarlhens@users.noreply.github.com>
This fixes an issue with the dependency resolver not finding the correct file. The commonJS one had an external reference to Vue, which doesn't exist in this project, and was preventing tests with references to `highlight.js` from even running. The ESM version doesn't, so it works if it were specially aliased. Fortunately, this was fixed upstream here: highlightjs/vue-plugin#27
There is an issue when trying to use this with vite-ssg:
Adding these exports fixes it.