Skip to content

Instantly share code, notes, and snippets.

@keyserfaty
Last active August 1, 2016 15:12
Show Gist options
  • Save keyserfaty/2a2abad84d21a4e40df312749f92f30a to your computer and use it in GitHub Desktop.
Save keyserfaty/2a2abad84d21a4e40df312749f92f30a to your computer and use it in GitHub Desktop.
Webpack bugs

Module '...' not found

  1. I got this error after adding a repo from its folder directly. This other repo had its own pkg json and so webpack mistake this pkg json from the root one. I solved this by specifing webpack where to look for the node_modules directly with an 'include' property:
loaders: [
  {
    test: /\.js$|.jsx$/,
    exclude: /node_modules/,
    loader: 'react-hot!babel-loader',
    include: path.join(__dirname, 'src')
  },
]
  1. I also had to specify a resolveLoader with the path to node_modules:
resolveLoader: {
  root: path.join(__dirname, 'node_modules'),
},

'json' or 'json-loader' not found

  1. The loader wasn't installed. After installing it I could use it normally.
{
  test: /\.json$/,
  loader: 'json-loader'
},
  1. I did also specify it in the resolveLoader, so that it would use it to handle all pkg jsons:
resolveLoader: {
  packageMains: ['json-loader']
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment