From 56f52db5a90aca30ef2fedaf9416638e9a783e65 Mon Sep 17 00:00:00 2001 From: Watcharakrit Phantu Date: Sun, 2 Jul 2017 05:36:36 +0700 Subject: [PATCH] Fixed example `with-scoped-stylesheets-and-postcss`: css-modules reload update from files [name].css.json. (#2110) * Fixed: css-modules reload files styles.css.json. * update: disable uglify for next build. add: require('fs') for next build. add: disable uglify on next.config.js for next build. * Fix linting errors --- .../with-scoped-stylesheets-and-postcss/next.config.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/with-scoped-stylesheets-and-postcss/next.config.js b/examples/with-scoped-stylesheets-and-postcss/next.config.js index b161630f..f28c051e 100644 --- a/examples/with-scoped-stylesheets-and-postcss/next.config.js +++ b/examples/with-scoped-stylesheets-and-postcss/next.config.js @@ -1,7 +1,12 @@ +const fs = require('fs') const trash = require('trash') module.exports = { webpack: (config) => { + config.plugins = config.plugins.filter( + (plugin) => (plugin.constructor.name !== 'UglifyJsPlugin') + ) + config.module.rules.push( { test: /\.css$/, @@ -17,7 +22,7 @@ module.exports = { options: { procedure: function (content) { const fileName = `${this._module.userRequest}.json` - const classNames = JSON.stringify(require(fileName)) + const classNames = fs.readFileSync(fileName, 'utf8') trash(fileName)