Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in sass files (sass-loader) crash the server #1396

Closed
ruslansavenok opened this issue Mar 12, 2017 · 2 comments
Closed

Errors in sass files (sass-loader) crash the server #1396

ruslansavenok opened this issue Mar 12, 2017 · 2 comments

Comments

@ruslansavenok
Copy link

With following next.config.js

module.exports = {
  webpack: (config) => {
    config.module.rules.push(
      {
        test: /\.scss$/,
        use: ExtractTextPlugin.extract({
          use: [
            {
              loader: 'css-loader',
              options: {
                sourceMap: true
              }
            },
            {
              loader: 'sass-loader',
              options: {
                sourceMap: true
              }
            }
          ]
        })
      }
    )

    config.plugins.push(
      new ExtractTextPlugin('static/main.css')
    )

    return config
  }
}

When I have error in sass file, server crashes with following error:

 WAIT  Compiling...
 ERROR  Failed to compile with 2 errors

 error  in ./styles/main.scss

Module build failed: Error
    at /Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/NormalModule.js:141:35
    at /Users/ruslansavenok/Projects/jobmagnt/node_modules/loader-runner/lib/LoaderRunner.js:364:11
    at /Users/ruslansavenok/Projects/jobmagnt/node_modules/loader-runner/lib/LoaderRunner.js:230:18
    at context.callback (/Users/ruslansavenok/Projects/jobmagnt/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Object.asyncSassJobQueue.push [as callback] (/Users/ruslansavenok/Projects/jobmagnt/node_modules/sass-loader/lib/loader.js:51:13)
    at Object.<anonymous> (/Users/ruslansavenok/Projects/jobmagnt/node_modules/async/dist/async.js:2237:31)
    at apply (/Users/ruslansavenok/Projects/jobmagnt/node_modules/async/dist/async.js:20:25)
    at Object.<anonymous> (/Users/ruslansavenok/Projects/jobmagnt/node_modules/async/dist/async.js:56:12)
    at Object.callback (/Users/ruslansavenok/Projects/jobmagnt/node_modules/async/dist/async.js:843:16)
    at options.error (/Users/ruslansavenok/Projects/jobmagnt/node_modules/node-sass/lib/index.js:294:32)

 error

/Users/ruslansavenok/Projects/jobmagnt/node_modules/extract-text-webpack-plugin/loader.js??ref--7-0!/Users/ruslansavenok/Projects/jobmagnt/node_modules/css-loader/index.js??ref--7-1!/Users/ruslansavenok/Projects/jobmagnt/node_modules/sass-loader/lib/loader.js??ref--7-2!/Users/ruslansavenok/Projects/jobmagnt/styles/main.scss doesn't export content

/Users/ruslansavenok/Projects/jobmagnt/node_modules/next/dist/server/hot-reloader.js:361
                    return e.module.reasons;
                                   ^

TypeError: Cannot read property 'reasons' of undefined
    at /Users/ruslansavenok/Projects/jobmagnt/node_modules/next/dist/server/hot-reloader.js:361:36
    at Array.map (native)
    at Compiler.<anonymous> (/Users/ruslansavenok/Projects/jobmagnt/node_modules/next/dist/server/hot-reloader.js:360:79)
    at Compiler.applyPlugins (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:61:14)
    at Watching._done (/Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/Compiler.js:91:17)
    at onCompiled (/Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/Compiler.js:50:17)
    at /Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/Compiler.js:480:13
    at next (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:138:11)
    at Compiler.<anonymous> (/Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/CachePlugin.js:62:5)
    at next (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:140:14)
    at Compiler.<anonymous> (/Users/ruslansavenok/Projects/jobmagnt/node_modules/next/dist/server/build/plugins/json-pages-plugin.js:56:9)
    at Compiler.applyPluginsAsyncSeries (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:142:13)
    at /Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/Compiler.js:477:10
    at Compilation.applyPluginsAsyncSeries (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:131:46)
    at self.applyPluginsAsync.err (/Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/Compilation.js:640:19)
    at next (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:138:11)
    at Compilation.<anonymous> (/Users/ruslansavenok/Projects/jobmagnt/node_modules/next/dist/server/build/plugins/watch-pages-plugin.js:40:11)
    at Compilation.applyPluginsAsyncSeries (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:142:13)
    at self.applyPluginsAsync.err (/Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/Compilation.js:631:11)
    at Compilation.applyPluginsAsyncSeries (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:131:46)
    at self.applyPluginsAsync.err (/Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/Compilation.js:626:10)
    at next (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:138:11)
    at ExtractTextPlugin.<anonymous> (/Users/ruslansavenok/Projects/jobmagnt/node_modules/extract-text-webpack-plugin/index.js:341:4)
    at Compilation.applyPluginsAsyncSeries (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:142:13)
    at sealPart2 (/Users/ruslansavenok/Projects/jobmagnt/node_modules/webpack/lib/Compilation.js:622:9)
    at next (/Users/ruslansavenok/Projects/jobmagnt/node_modules/tapable/lib/Tapable.js:138:11)
    at ExtractTextPlugin.<anonymous> (/Users/ruslansavenok/Projects/jobmagnt/node_modules/extract-text-webpack-plugin/index.js:313:5)
    at /Users/ruslansavenok/Projects/jobmagnt/node_modules/async/dist/async.js:359:16
@arunoda
Copy link
Contributor

arunoda commented Mar 13, 2017

See this: #544

We don't support loaders like this. (Almost all the loaders)

@arunoda arunoda closed this as completed Mar 13, 2017
@sedubois
Copy link
Contributor

We don't support loaders like this

But hopefully some day: #1245

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants