React+webpack tutorial needs additional steps due to webpack changes
mcclure opened this issue · 1 comments
I use this tutorial from time to time when I need to create a new project.
https://www.typescriptlang.org/docs/handbook/react-&-webpack.html
I ran through it today. There were two problems.
-
webpack now gets annoyed if you install it by itself but do not install webpack-cli. When I tried naively installing both webpack on top of webpack-cli, I then ran into some other weird problem involving package mismatches, which I think is what happens if you install webpack-cli on top of an old webpack. To avoid weirdness, I recommend adding webpack and webpack-cli to the local build, then running
npx webpack
instead ofwebpack
. But in any case you must change your tutorial to address webpack-cli. -
When I run webpack with the configuration file in your tutorial, I get
WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment. You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/
I don't know what this means.
Expected behavior: I should be able to run all the steps in the tutorial in order and it should work with no warnings or strange messages like "do you want to install webpack-cli?".
Note I do not need help on resolving the above issues on my local system.