'react-suneditor css not loading on production
I set up react-suneditor just as it said in the docs, using dynamic loading since I'm using Next.js.
import React from 'react';
import dynamic from "next/dynamic";
import 'suneditor/dist/css/suneditor.min.css'; // Import Sun Editor's CSS File
const SunEditor = dynamic(() => import("suneditor-react"), {
ssr: false,
});
const MyComponent = props => {
return (
<div>
<p> My Other Contents </p>
<SunEditor />
</div>
);
};
export default MyComponent;
And the rich text editor works and looks fine when developing on my macbook. However when I push to my server on Heroku it totally messes up the styling. I wonder if there is an issue when loading the css?
Solution 1:[1]
I made it work by importing source css instead of the dist one :import 'suneditor/src/assets/css/suneditor.css'
But IMHO, this is just a workaround.
I suggest to open an issue on https://github.com/mkhstar/suneditor-react
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sébastien Auvray |