prismjs import error - require is not define
nepaul opened this issue · comments
-
Searched existing issues to avoid creating duplicates.
-
Confirmed that it can be reproduced in muya.
Describe the bug
When I integrated "muya" into my project, the following error occurred (I'm using the latest version of npm - "@marktext/muya": "^0.2.1",
).
This seems to be a common error with Vite.
Unknown variable dynamic import: ../../../node_modules/prisms/components/prism-latex.js te: July at eval (webpack-internal:///../muya/dist/chunks/emptyStates. cbb949b2.js:2179:86)
Unknown variable dynamic import: ../../.. /node_modules /prismjs/components/prism-yaml.js
require is not defined
ReferenceError: require is not defined
at eval (webpack-internal:/// ../muva/dist/chunks/prism-keep-markup.6f6991cb.is:2:1)
at . . /mua/dist/chunks/prism-keep-markup.6f6991cb.js(http://localhost:3000/js/muya_dist_chunks_prism-keep-markup_6f6991cb_js.js:18:1)
at webpack_require.
(http://localhost:3000/js/app.is:737:33)
at Function. fn (http://localhost:3000/js/app.js: 1110:21)
To Reproduce
Steps to reproduce the behavior:
import Muya from '@marktext/muya';
import {
EmojiSelector,
InlineFormatToolbar,
ImageEditTool,
ImageToolBar,
ImageResizeBar,
CodeBlockLanguageSelector,
TableColumnToolbar,
ParagraphQuickInsertMenu,
TableDragBar,
TableRowColumMenu,
PreviewToolBar,
ParagraphFrontButton,
ParagraphFrontMenu,
} from '@marktext/muya/dist/ui/index';
Expected behavior
A clear and concise description of what you expected to happen.
Actual behavior
The actual result of this bug
Operation System and Browser version (please complete the following information):
- OS: macOS Ventura 13.6
- Browser: [ Chrome Version 116.0.5845.187 (arm64)]
Muya Version
"^0.2.1"
I can't reproduce this problem, upgrade node and vite to the latest version to try?