Module not found: Error: Package path ./highlight.min.js is not exported from package @highlightjs\cdn-assets
See original GitHub issueDescribe the issue/behavior that seems buggy
Module not found: Error: Package path ./highlight.min.js is not exported from package D:\Documents\github\markdown-reader\node_modules@highlightjs\cdn-assets (see exports field in D:\Documents\github\markdown-reader\node_modules@highlightjs\cdn-assets\package.json)
Sample Code or Instructions to Reproduce
import hljs from "@highlightjs/cdn-assets/highlight.min.js";
export default hljs;
Expected behavior
Additional context
webpack 5.38.1 @highlightjs/cdn-assets 11.0.0
{
"exports": {
".": {
"require": "./lib/index.js",
"import": "./es/index.js"
},
"./package.json": "./package.json",
"./lib/common": {
"require": "./lib/common.js",
"import": "./es/common.js"
},
"./lib/core": {
"require": "./lib/core.js",
"import": "./es/core.js"
},
"./lib/languages/*": {
"require": "./lib/languages/*.js",
"import": "./es/languages/*.js"
},
"./scss/*": "./scss/*",
"./styles/*": "./styles/*",
"./types/*": "./types/*"
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Module not found: Error: Package path . is not exported from ...
In the relevant .js script import Firestore and Firebase as follows: ... Even after doing that you will get error of module not...
Read more >highlight.js
Syntax highlighting for the Web ... multi-language code highlighting; available for node.js; works with any markup; compatible with any js framework.
Read more >auroralabs - Laracasts
Hi, Im trying to import some Swiper 7 modules into a projct and when i hit mix the following exception is thrown Module...
Read more >@joshgoebel/highlight.js-cdn-assets - npm package | Snyk
The npm package @joshgoebel/highlight.js-cdn-assets was scanned for known vulnerabilities and missing license, and no issues were found. Thus ...
Read more >highlight.js - npm
This will find and highlight code inside of <pre><code> tags; it tries to detect the language automatically. If automatic detection doesn't ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Using a separate variable to store the module name seems to have fixed this for me. So instead of
you would use:
I have no idea why and if this actully works. Fixes my build and the example in the webpack issue though.
This seems to be broken for me as well. I’m getting the following error message:
This message appears when using the dynamic import syntax
The following are all solutions that fix the problem for me:
Removing the
exports
field frompackage.json
Adding one more export as follows:
Downgrading to the latest v10 release fixes this problem for me. Removing the
exports
from v11 also fixes the problem. So something about theexports
key in thepackage.json
for v11 has to be the cause.Framework: Vue 3 (Vue CLI 5) Language: TypeScript Bundler: Webpack 5 Node: 14 npm: 7