Home

Issue: 1095

PostCSS Loader - SourceMap warning

[issue link]

PostCSS loader keeps complaining about soureMap isn’t set. Tried many different things, but nothing seems to work.

(Emitted value instead of an instance of Error)

 ⚠️  PostCSS Loader

Previous source map found, but options.sourceMap isn't set.
In this case the loader will discard the source map entirely for performance reasons.
See https://github.com/postcss/postcss-loader#sourcemap for more information.



 @ ./~/vue-style-loader!./~/css-loader?sourceMap!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-36d0932b","scoped":false,"hasInlineConfig":true}!./~/postcss-loader/lib!./~/vue-loader/lib/selector.js?type=styles&index=0!./components/PageHeader.vue 4:14-335 13:3-1
7:5 14:22-343
 @ ./components/PageHeader.vue
 @ ./~/babel-loader/lib?{"presets":["vue-app"],"babelrc":false,"cacheDirectory":true}!./~/vue-loader/lib/selector.js?type=script&index=0!./pages/index.vue
 @ ./pages/index.vue
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi webpack-hot-middleware/client?reload=true ./.nuxt/client.js

nuxt.config.js

build: {
    extend(config, ctx) {
      const cssLoader = config.module.rules.find((loader) => loader.test.toString() === '/\\.css$/')
      cssLoader.use.splice(2, 0, {
        loader: 'postcss-loader',
        options: {
          sourceMap: true
        }
      })
  }

postcss.config.js

module.exports = {
  plugins: {
    'postcss-import': {},
    'postcss-cssnext': { autoprefixer: true },
    'postcss-nested': {},
    'cssnano': {}
  },
  sourceMap: true
}
This question is available on Nuxt.js community (#c961)