-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
Compiled version of the CSS #57
Comments
@OmarZeidan Upgrade |
@jaywcjlove Thanks but the same error! Look inside import './codemirror.css';
import './index.css'; Which will def be causing the error for next.js framework and Global CSS dilemma! |
@OmarZeidan Can you give me an example, let me debug it? |
Next.js says this, when I try to use the component. error - ./node_modules/@uiw/react-codemirror/lib/esm/codemirror.css Is this a good example? Try to render this component. import Codemirror from "@uiw/react-codemirror";
export default function CodeEditor() {
function onChange(instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) {
console.log('instance :>> ', instance.getValue);
}
return <Codemirror
options={{
theme: 'monokai',
keyMap: 'sublime',
mode: 'jsx',
}}
onChange={onChange}
/>
} |
@Gnarus-G Since codemirror does not support server-side rendering, it is a bit strange to implement. Upgrade import { useEffect, useState } from 'react';
function HomePage() {
const [comp, setComp] = useState();
useEffect(() => {
if (window) {
import('@uiw/react-codemirror').then((obj) => {
if (!comp) {
setComp(obj.default);
}
});
}
}, []);
const Comps = comp;
return (
<div>
<div>Welcome to Next.js!</div>
{Comps && (
<Comps
value="const a = 0;"
options={{
mode: "jsx",
}}
/>
)}
</div>
)
}
export default HomePage $ yarn add @zeit/next-css Add const withCSS = require('@zeit/next-css');
module.exports = withCSS({
// Your configurations here
}); |
@jaywcjlove Oh man, I appreciate you. I learned a lot from this. Thank you. |
Can you please have the CSS compiled instead of being imported from the
node_modules
Where:
react-codemirror/src/index.js
Line 3 in cd62bbd
And L5
This is causing troubles when we use the library for
next.js
<3
The text was updated successfully, but these errors were encountered: