Styles are not applied on Webpack5
See original GitHub issueHello guys, I am using Draftjs mention plugin and I am getting the result below
This is my webpack5 code:
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
And this is my code
import React, { ReactElement, useRef, useState } from 'react';
import { EditorState } from 'draft-js';
import Editor from '@draft-js-plugins/editor';
import createMentionPlugin, {
defaultSuggestionsFilter,
} from '@draft-js-plugins/mention';
import editorStyles from './editorStyles.css';
import mentions from './Mention';
import '@draft-js-plugins/mention/lib/plugin.css';
const mentionPlugin = createMentionPlugin();
const { MentionSuggestions } = mentionPlugin;
const plugins = [mentionPlugin];
const SimpleMentionEditor = (): ReactElement => {
const [editorState, setEditorState] = useState(EditorState.createEmpty());
const editor = useRef<Editor>();
const [open, setOpen] = useState(false);
const [search, setSearch] = useState('');
const onChange = (value): void => {
setEditorState(value);
};
const focus = (): void => {
editor.current.focus();
};
const onOpenChange = (newOpen): void => {
setOpen(newOpen);
};
const onSearchChange = ({ value }): void => {
setSearch(value);
};
const onAddMention = (): void => {
// get the mention object selected
};
return (
<div className={editorStyles.editor} onClick={focus}>
<Editor
editorState={editorState}
onChange={onChange}
plugins={plugins}
ref={(element) => {
editor.current = element;
}}
/>
<MentionSuggestions
open={open}
suggestions={defaultSuggestionsFilter(search, mentions)}
onOpenChange={onOpenChange}
onSearchChange={onSearchChange}
onAddMention={onAddMention}
/>
</div>
);
};
export default SimpleMentionEditor;
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:24 (9 by maintainers)
Top Results From Across the Web
javascript - Webpack - CSS not applied - Stack Overflow
The problem is that CSS in not being applied the elements on the page (it is present in the built file). This is...
Read more >style-loader - webpack
Disclaimer: style-loader is a third-party package maintained by community members, it potentially does not have the same support, security policy or license ...
Read more >Loading Styles - SurviveJS
Webpack doesn't handle styling out of the box, and you will have to use ... Loaders return the new source files with transformations...
Read more >How to configure CSS Modules for webpack - LogRocket Blog
In the following code block, css-loader and style-loader are used together. Similar to babel-loader , we can load CSS files to style our...
Read more >Client side extension imported css via webpack css loader is ...
js”, however, they are somehow not applied. I have the impression that aui are somehow overriding these. My CSS styling approach is the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After changing to
in @ draft-js-plugins /**/ package.json everything works fine
Can you try to change the
sideEffects
option in the@draft-js-plugins/*
packages toIf this solves the issue I will replace them here.