uiwjs / react-codemirror

CodeMirror 6 component for React. @codemirror https://uiwjs.github.io/react-codemirror/
https://uiwjs.github.io/react-codemirror/
MIT License
1.69k stars 135 forks source link

ReferenceError: require is not defined in @babel/runtime/helpers/esm/extends.js #554

Closed yi-you closed 1 year ago

yi-you commented 1 year ago

Description

I'm encountering a ReferenceError: require is not defined error in my Vue project when building with Webpack. The error occurs in the @babel/runtime/helpers/esm/extends.js file.

Environment

Error Details

ReferenceError: require is not defined
    at ./node_modules/@babel/runtime/helpers/esm/extends.js (extends.js:3:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./node_modules/@uiw/codemirror-theme-github/esm/index.js (chunk-vendors.cf2ca45f-2.1.7.js:19:88)
jaywcjlove commented 1 year ago

Vue version: 2.6.10 ?????

@yi-you Can it run in vue?

jaywcjlove commented 1 year ago

@yi-you

yi-you commented 1 year ago

Vue version: 2.6.10 ?????

@yi-you Can it run in vue?

Yes, it runs normally when I use node12 + webpack4.

yi-you commented 1 year ago

@yi-you

emm, I'm using vue-cli 5.0.8 šŸ˜‚ I'm going to check how to upgrade to Vite.

yi-you commented 1 year ago

Is the codemirror-theme-github compatible with babel7 and webpack5?

jaywcjlove commented 1 year ago

@yi-you I can't reproduce your error

https://codesandbox.io/embed/codemirror-v6-vite-uiw-codemirror-theme-github-t7f3gp?fontsize=14&hidenavigation=1&theme=dark

yi-you commented 1 year ago

Thank you very much. I've also set up a demo to test this theme, and it works perfectly.