zikaari / css-visor

Webpack supervisor to inject and hot update stylesheets with sourcemaps
MIT License
8 stars 1 forks source link

Can it be used with scss files? #7

Open sunil-jhamnani-zz opened 5 years ago

sunil-jhamnani-zz commented 5 years ago

I am using scss files in my project as this is hoe my webpack.config.js looks like this:

{
    test: /\.scss$/,
        resolve: {
            extensions: ['.css', '.scss']
        },
        use: [
            IS_DEV
                ? {
                loader: 'css-visor/loader',
                }
                 : MiniCssExtractPlugin.loader,
                {
                    loader: 'css-loader',
                    options: {
                        sourceMap: IS_DEV
                    }
                },
                {
                    loader: 'postcss-loader',
                    options: {
                        sourceMap: IS_DEV
                    }
                },
                {
                    loader: 'sass-loader',
                    options: {
                    data: '@import \'styles/abstracts/index\';',
                    sourceMap: IS_DEV
                }
        }
    ]
}

This is a block added in module. Let me know if there is anything to add in this. I am getting this error right now

ERROR in ./app/automate/Details/styles/ProjectTag.scss
Module build failed (from ./node_modules/css-visor/loader.js):
NonErrorEmittedError: (Emitted value instead of an instance of Error) TypeError: require(...) is not a function
    at runLoaders (/Users/sunil/bsstag/railsApp/react_new/node_modules/webpack/lib/NormalModule.js:283:13)
    at /Users/sunil/bsstag/railsApp/react_new/node_modules/loader-runner/lib/LoaderRunner.js:364:11
    at /Users/sunil/bsstag/railsApp/react_new/node_modules/loader-runner/lib/LoaderRunner.js:230:18
    at runSyncOrAsync (/Users/sunil/bsstag/railsApp/react_new/node_modules/loader-runner/lib/LoaderRunner.js:143:3)
    at iterateNormalLoaders (/Users/sunil/bsstag/railsApp/react_new/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
    at iterateNormalLoaders (/Users/sunil/bsstag/railsApp/react_new/node_modules/loader-runner/lib/LoaderRunner.js:218:10)
    at /Users/sunil/bsstag/railsApp/react_new/node_modules/loader-runner/lib/LoaderRunner.js:233:3
    at context.callback (/Users/sunil/bsstag/railsApp/react_new/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at process.then.result (/Users/sunil/bsstag/railsApp/react_new/node_modules/css-loader/dist/index.js:261:12)

For all scss files

zikaari commented 5 years ago

Do you have CSSVisorPlugin in plugins of your config?

If not, please try that.

If you already do, I'd like to see ProjectTag.scss file and perhaps find the culprit.

PS: To ease communication over GH issues or any other platform that uses Markdown, please format code in a more readable way :) Markdown - Code formatting