webpack / webpack-cli

Webpack's Command Line Interface
https://webpack.js.org/api/cli
MIT License
2.56k stars 603 forks source link

Generated typescript project with sass throws error. #3171

Closed TheRealSyler closed 2 years ago

TheRealSyler commented 2 years ago

What is the current behavior?

crashes on yarn serve, the reason is in the generated webpack config file there is an undefined variable called stylesHandler.

To Reproduce

Steps to reproduce the behavior:

  1. In an empty folder run yarn add -D @webpack-cli/generators && npx webpack-cli init

  2. Choose these options:

    ? Which of the following JS solutions do you want to use? Typescript
    ? Do you want to use webpack-dev-server? Yes
    ? Do you want to simplify the creation of HTML files for your bundle? Yes
    ? Do you want to add PWA support? Yes
    ? Which of the following CSS solutions do you want to use? SASS
    ? Will you be using CSS styles along with SASS in your project? No
    ? Will you be using PostCSS in your project? No
    ? Do you want to extract CSS for every file? No
    ? Do you like to install prettier to format generated configuration? Yes
    ? Pick a package manager: yarn
  3. run yarn serve

Expected behavior

Not crash when running yarn serve.

Please paste the results of npx webpack-cli info here, and mention other relevant information

  System:
    OS: Windows 10 10.0.22000
    CPU: (6) x64 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
    Memory: 8.29 GB / 15.96 GB
  Binaries:
    Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.15 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.5.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (99.0.1150.39) 
    Internet Explorer: 11.0.22000.120
  Packages:
    html-webpack-plugin: ^5.5.0 => 5.5.0
    sass-loader: ^12.6.0 => 12.6.0
    ts-loader: ^9.2.8 => 9.2.8
    webpack: ^5.70.0 => 5.70.0
    webpack-cli: ^4.9.2 => 4.9.2
    webpack-dev-server: ^4.7.4 => 4.7.4
    workbox-webpack-plugin: ^6.5.1 => 6.5.1
TheRealSyler commented 2 years ago

ill take a look at it myself so i might create a pr later.

TheRealSyler commented 2 years ago

the service worker file also doesn't seem to be created.

webpack-bot commented 2 years ago

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

TheRealSyler commented 2 years ago

fixed with #3412