Static GitHub Issues

[109] Error in CSS Modules when `nuxt generate`

prev: Using external resources with Nuxt
next: route transition stops working when switching layout

Is this error due to vue-loader or vue-template-compiler?

The Vue file where the error occurs is as follows.

<template>
    <div>
       <h1 :class="$style.red">This is test</h1>
    </div>
</template>

<style module>
	.red {
		color: #00f;
	}
</style>

This is the log when nuxt generate is executed.

~/h/sample ⋊> npm run generate                                                                                                                                                                                                        

> projectname@1.0.0 generate /Users/username/htdocs/sample
> nuxt generate

keywords if/then/else require v5 option
[nuxt] Generating...
  nuxt:build App root: /Users/username/htdocs/sample +0ms
  nuxt:build Generating .nuxt/ files... +0ms
  nuxt:build Generating routes... +8ms
  nuxt:build Generating files... +7ms
  nuxt:build Building files... +10ms
[nuxt:build:server]
 Hash: ac16a5fff8e535e08863
Version: webpack 2.2.0-rc.2
Time: 4207ms
                                        Asset     Size  Chunks             Chunk Names
img/logo.png?ddcb7676062267970e1c6e9572b29601  6.54 kB          [emitted]
                             server-bundle.js   123 kB       0  [emitted]  main

ERROR in ./~/extract-text-webpack-plugin/loader.js?{"omit":0,"remove":true}!./~/css-loader?{"localIdentName":"[hash:base64]_0","modules":true,"importLoaders":true}!./~/vue-loader/lib/style-rewriter.js?id=data-v-80d1978a!./~/vue-loader/lib/selector.js?type=styles&index=0!./pages/sample.vue
Module build failed: Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin, refer to https://github.com/webpack/extract-text-webpack-plugin for the usage example
    at Object.module.exports.pitch (/Users/username/htdocs/sample/node_modules/extract-text-webpack-plugin/loader.js:26:9)
 @ ./pages/sample.vue 5:27-322
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/server.js
[nuxt:build:client]
 Hash: ed23897bbb38f675b6ea
Version: webpack 2.2.0-rc.2
Time: 4238ms
                                        Asset       Size  Chunks             Chunk Names
img/logo.png?ddcb7676062267970e1c6e9572b29601    6.54 kB          [emitted]
                             0.nuxt.bundle.js    2.18 kB       0  [emitted]
                             1.nuxt.bundle.js    1.28 kB       1  [emitted]
                             2.nuxt.bundle.js    1.05 kB       2  [emitted]
                             3.nuxt.bundle.js  778 bytes       3  [emitted]
                             4.nuxt.bundle.js  716 bytes       4  [emitted]
                               nuxt.bundle.js    39.4 kB       5  [emitted]  app
                             vendor.bundle.js    89.6 kB       6  [emitted]  vendor
                                    style.css    1.54 kB       5  [emitted]  app
                                style.css.map   86 bytes       5  [emitted]  app
Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

  nuxt:generate Destination folder cleaned +4s
  nuxt:generate Static & build files copied +15ms
  nuxt:render Rendering url /about +2ms
  nuxt:render Rendering url / +25ms
  nuxt:render Rendering url /sample +17ms
Error: Module build failed: Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin, refer to https://github.com/webpack/extract-text-webpack-plugin for the usage example
    at Object.module.exports.pitch (/Users/username/htdocs/sample/node_modules/extract-text-webpack-plugin/loader.js:26:9)
    at Object.module.exports.__vue_styles__ (__vue_ssr_bundle__:3232:7)
    at __webpack_require__ (__vue_ssr_bundle__:21:30)
    at Object.module.exports.module.exports.render._vm (__vue_ssr_bundle__:3536:28)
    at __webpack_require__ (__vue_ssr_bundle__:21:30)
    at Object.module.exports.Object.defineProperty.value (__vue_ssr_bundle__:1496:5)
    at __webpack_require__ (__vue_ssr_bundle__:21:30)
    at Object.<anonymous> (__vue_ssr_bundle__:958:69)
    at __webpack_require__ (__vue_ssr_bundle__:21:30)
    at Object.<anonymous> (__vue_ssr_bundle__:3784:65)
    at __webpack_require__ (__vue_ssr_bundle__:21:30)
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This bug report is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c89">#c89</a>)</em></sub></div>