Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Nuxt3 Use npm run build "default" is not exported by "node_modules/highlight.js/lib/index.js" #4246

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

Open
AABBCC-cloud opened this issue Apr 26, 2025 · 1 comment
Labels
bug help welcome Could use help from community parser

Comments

@AABBCC-cloud
Copy link

npm run build

build
nuxt build

Nuxt 3.16.2 with Nitro 2.11.8 nuxi 16:05:39
ℹ Building for Nitro preset: node-server nuxi 16:05:42
ℹ Building client... 16:05:50
ℹ vite v6.2.5 building for production... 16:05:50
ℹ ✓ 2339 modules transformed. 16:06:03

ERROR ✗ Build failed in 12.82s 16:06:03

[ nuxi 16:06:03] ERROR Nuxt Build Error: node_modules/highlight.js/es/index.js (2:7): "default" is not exported by "node_modules/highlight.js/lib/index.js", imported by "node_modules/highlight.js/es/index.js".
file: C:/Users/xkgoo/Desktop/starter/node_modules/highlight.js/es/index.js:2:7

1: // https://nodejs.org/api/packages.html#packages_writing_dual_packages_while_avoiding_or_minimizing_hazards
2: import HighlightJS from '../lib/index.js';
^
3: export { HighlightJS };
4: export default HighlightJS;

@AABBCC-cloud AABBCC-cloud added bug help welcome Could use help from community parser labels Apr 26, 2025
@joshgoebel
Copy link
Member

If you look at our sources you'll see we do export default from lib. This works fine for node... maybe file an issue with nuxt?


You may want to try the CDN assets which include pure ES6 builds though.

https://www.npmjs.com/package/@highlightjs/cdn-assets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help welcome Could use help from community parser
Projects
None yet
Development

No branches or pull requests

2 participants