Css-loader: Nuxt build exportOnlyLocals invalid option

Created on 22 Jul 2019  路  3Comments  路  Source: webpack-contrib/css-loader

  • Operating System: MacOS
  • Node Version: 12.1.0
  • NPM Version: 6.9.0
  • webpack Version: 4.30.0
  • css-loader Version: 3.0.0

Expected Behavior

Nuxt should build the app

Actual Behavior

ERROR in ./assets/stylus/app.styl (./node_modules/css-loader/dist/cjs.js??ref--10-oneOf-1-1!./node_modules/postcss-loader/src??ref--10-oneOf-1-2!./node_modules/stylus-loader??ref--10-oneOf-1-3!./assets/stylus/app.styl)
Module build failed (from ./node_modules/css-loader/dist/cjs.js):
ValidationError: Invalid options object. CSS Loader has been initialised using an options object that does not match the API schema.

  • options has an unknown property 'exportOnlyLocals'.

How Do We Reproduce?

Run yarn run build with css-loader 3.0.0. On 2.1.1 it works

Most helpful comment

There is a fix for this in nuxt that was commited last month, but not sure when it is to be released. https://github.com/nuxt/nuxt.js/blame/e7cc2757c3aea7076b82fc9c65700d48eab01586/packages/webpack/src/utils/style-loader.js#L71

All 3 comments

Because in css-loader@3 has no option exportOnlyLocals, it is onlylocals https://github.com/webpack-contrib/css-loader#onlylocals now

@danigomonea did you solve this problem in nuxt context?

There is a fix for this in nuxt that was commited last month, but not sure when it is to be released. https://github.com/nuxt/nuxt.js/blame/e7cc2757c3aea7076b82fc9c65700d48eab01586/packages/webpack/src/utils/style-loader.js#L71

Was this page helpful?
0 / 5 - 0 ratings