Skip to content
New issue

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

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

Already on GitHub? # to your account

Module Build Failed: Unknown Word when trying to modify webpack config #407

Closed
zweicoder opened this issue Aug 25, 2016 · 1 comment
Closed

Comments

@zweicoder
Copy link

I copied the example in README.md

// gatsby-node.js
exports.modifyWebpackConfig = function(config, env) {
  config.removeLoader('css')
  config.loader('css', function(cfg) {
    cfg.test = /\.css$/
    cfg.loader = 'style!css?modules'
    return cfg
  })
  return config
}

and got this:

ERROR in ./~/css-loader?modules&minimize&importLoaders=1&sourceMap&localIdentName=[name]---[local]---[hash:base64:5]!./~/postcss-loader!./~/style-loader!./~/css-loader?modules!./pages/styles.module.css
Module build failed: Unknown word (5:1)

  3 | // load the styles
  4 | var content = require("!!./../node_modules/css-loader/index.js?modules!./styles.module.css");
> 5 | if(typeof content === 'string') content = [[module.id, content, '']];
    | ^
  6 | // add the styles to the DOM
  7 | var update = require("!./../node_modules/style-loader/addStyles.js")(content, {});
  8 | if(content.locals) module.exports = content.locals;

Any idea why?

@zweicoder
Copy link
Author

ok my mistake, I removed the css loader but did not remove the cssModule loader.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant