bocoup / webpack-workshop

Other
6 stars 2 forks source link

Update to Webpack 2 #56

Closed kadamwhite closed 7 years ago

mzgoddard commented 7 years ago

00/01/03-initial-setup

Line 85

path: 'dist',

should be something like

path: path.join(__dirname, 'dist'),

webpack 1's configuration docs say this should have been absolute already but webpack 1 let it slide for users. webpack 2 demands this to be absolute.

LIne 99

You might add that path must be absolute here.

00/01/04-exercise-my-first-app

Line 80 and 181

path: 'dist',

too must be absolute.

00/02/00-webpack-loaders

Line 59

It may be useful here to mention that webpack 1 allowed you omit -loader. webpack 2 does not allow this and will emit an error. This may be useful to mention for anyone in the class who may prior interaction with webpack 1.

00/02/01-file-loader

Line 76

  module: {
    loaders: [
      {
        test: /\.(jpg|png)$/,
        loader: 'file-loader',
      },
    ],
  },

Loaders has been replaced by a more generic rules member.

  module: {
    rules: [
      {
        test: /\.(jpg|png)$/,
        loader: 'file-loader',
      },
    ],
  },

For the most part it doesn't change how you set it up much in this workshop. loader now can only be a string. More advanced things have changed more. Like there are nolonger preLoaders, and postLoaders keys on modules. Instead you use enforce: 'pre' and enforce: 'post' on the rule item in rules. And there is use which lets you define a series of loaders (which can be also optional with a test member). Its also possible to define a rule without any loader and instead assign other details like options for the webpack parser.

Line 88

mentions module.loaders. should be module.rules now.

00/02/02-exercise-file-loader

Line 24, 37, 53, 79

module.loaders should be module.rules

00/02/03-style-and-css-loaders

Line 86, 99

module.loaders should be module.rules

Line 87

file-loader should be style-loader and css-loader.

Line 90

loader: 'style-loader!css-loader' should be use: 'style-loader!css-loader'.

00/02/04-exercise-bundle-assets

Line 44

module.loaders should be module.rules

00/03/01-extract-text-webpack-plugin

Line 55, 71, 79

module.loaders should be module.rules

Line 100

loader should be rule.

Line 59, 83, 92

loader: ExtractTextPlugin.extract("style-loader", "css-loader") should be use: ExtractTextPlugin.extract({fallback: "style-loader", use: "css-loader"})

Line 95, 96, 104, 106

extract no longer takes multiple arguments. It only takes one. Update first argument to refer to the loader. Same for second argument.

Line 100

Update 2 arguments to 1 argument.

00/03/02-html-webpack-plugin

Line 60

[contentHash] should be [contenthash].

00/03/03-excercise-extract

Line 56

module.loaders should be module.rules

Line 60

loader: should be use:

Line 60

extract('style-loader', 'css-loader') should be extract({fallback: 'style-loader', use: 'css-loader'}).