uiwjs / react-md-editor

A simple markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-md-editor
MIT License
2.17k stars 157 forks source link

Working with custom Webpack config #278

Closed maryschmidt closed 3 years ago

maryschmidt commented 3 years ago

Hi, I'm struggling to get this package building with a custom Webpack config. I saw somewhere that Webpack needs to be configured to load CSS from node_modules, but I can't seem to get that working. Could you give me any pointers?

const excludeCssPaths = [
    /node_modules\/(?!(@uiw\/react-md-editor|@uiw\/react-markdown-preview)\/).*/
];
     new MiniCssExtractPlugin({
            filename: '[name].[contenthash].css',
            chunkFilename: '[id].[contenthash].css',
        }),
                {
                    test: /\.(css|less)$/,
                    exclude: [...excludeCssPaths],
                    use: [
                        MiniCssExtractPlugin.loader,
                        {
                            loader: 'css-loader',
                            options: {
                                importLoaders: 2,
                            },
                        },
                        {
                            loader: 'postcss-loader',
                        },
                        {
                            loader: 'less-loader', 
                            options: {
                                lessOptions: {
                                    relativeUrls: false,
                                },
                            },
                        },
                    ],
                },
maryschmidt commented 3 years ago

Nevermind.. Was foiled by a lurking test webpack config that I hadn't updated 🤦🏼‍♀️