andywer/webpack-blocks

Improve DX

andywer opened this issue · 2 comments

Improve the experience of using webpack-blocks as shared by @zcei: see comment

  • core: More useful output for createConfig() block assertion
  • dev-server: Document that it adds the HotModuleReplacementPlugin; maybe don't add it at all if --hot is found in the arguments (see webpack-contrib/style-loader#18)
  • extract-text: Investigate if re-using a plugin instance for multiple matches with the same file type test makes sense
zcei commented

Hej, I thought it might be cool to provide the actual configuration output of each block in its README, like this for babel:

Result

{
  module: {
    rules: [{
      test: context.match.test, // /\.(js|jsx)$/
      exclude: context.match.exclude, // /node_modules/
      use: [{
        loader: 'babel-loader',
        options: {
          cacheDirectory: options.cacheDirectory // true
        }
      }]
    }]
  }
}

I think this would make it easier to grasp when coming from a "pure" webpack background. What do you think?

(I would volunteer running each block once and adjusting the output to the style above & filing a PR)

Good idea! I am just not sure whether to provide the test: context.match.test stuff or the actual output for some example input.