Как добавить стилус с CSS-модулями в приложение «Создать React» - PullRequest
0 голосов
/ 03 июня 2019

Я создаю приложение с помощью Create React App. Я попытался извлечь стилус с модулями CSS, но он не работает.

Я получаю ошибку:

. / SRC / компоненты / общий / Button.styl (./Node_modules/css-loader/dist/cjs.js?modules&camelCase&localIdentName=[path][name][local]--[hash:base64:5]!./node_modules/stylus-loader! ./node_modules/postcss-loader/src??postcss!./node_modules/file-loader/dist/cjs.js??ref--7-oneOf-7!./src/components/common/Button.styl) Синтаксическая ошибка: неизвестное слово (1: 1)

1 | module.exports = webpack_public_path + "static / media / Button.e164e213.styl";

Я попытался добавить это в извлеченный файл webpack.config.js:

{
                test: /\.styl$/,
                use: [
                    'style-loader',
                    'css-loader?modules&camelCase&localIdentName=[path]__[name]__[local]--[hash:base64:5]',
                    'stylus-loader',
                    {
                        loader: require.resolve('postcss-loader'),
                        options: {
                            ident: 'postcss',
                            plugins: () => [
                                require('postcss-flexbugs-fixes'),
                                require('postcss-preset-env')({
                                    autoprefixer: {
                                        flexbox: 'no-2009'
                                    },
                                    stage: 3
                                })
                            ]
                        }
                    },
                ]
            }

И добавил соответствующие модули в мой пакет. Json

Любая помощь будет оценена

...