aurelia / cli

The Aurelia 1 command line tool. Use the CLI to create projects, scaffold components, and bundle your app for release.
MIT License
407 stars 133 forks source link

npm start fails with TypeError: Cannot read properties of undefined (reading 'loader') #1194

Closed HIRANO-Satoshi closed 2 years ago

HIRANO-Satoshi commented 2 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior:

$ npm install -g aurelia-cli $ au new (choose default TypeScript App and yarn) $ npm start

aurelia-sample@0.1.0 start webpack server

[webpack-cli] TypeError: Cannot read properties of undefined (reading 'loader') at module.exports (/Users/s-hirano/dev/tmp/aurelia-sample/webpack.config.js:202:47) at loadConfigByPath (/Users/s-hirano/dev/tmp/aurelia-sample/node_modules/webpack-cli/lib/webpack-cli.js:1745:27) at async WebpackCLI.loadConfig (/Users/s-hirano/dev/tmp/aurelia-sample/node_modules/webpack-cli/lib/webpack-cli.js:1830:30) at async WebpackCLI.createCompiler (/Users/s-hirano/dev/tmp/aurelia-sample/node_modules/webpack-cli/lib/webpack-cli.js:2185:18) at async Command. (/Users/s-hirano/dev/tmp/aurelia-sample/node_modules/@webpack-cli/serve/lib/index.js:98:30) at async Promise.all (index 1) at async Command. (/Users/s-hirano/dev/tmp/aurelia-sample/node_modules/webpack-cli/lib/webpack-cli.js:1672:7)

webpack.config.js has the following line at line 4.

const MiniCssExtractPlugin = require('mini-css-extract-plugin').default;

Removing .default fixes.

const MiniCssExtractPlugin = require('mini-css-extract-plugin');

3cp commented 2 years ago

au is not this aurelia-cli (for Aurelia v1), it's an unreleased tool for Aurelia 2. For far as I know, there is no "au new" for Aurelia 2 yet.

For aurelia-cli, npm install -g aurelia-cli, then do au new.

3cp commented 2 years ago

mini-css-extract-plugin had a breaking change in v2.5.0, https://github.com/aurelia/v1/commit/caf5af7246296d9adfd04ff465eef49bba6f2559

They restored cjs behaviour in v2.5.1. I will revert previous change.

3cp commented 2 years ago

Fixed.

HIRANO-Satoshi commented 2 years ago

@3cp 3cp, thanks for quick fix.

The above "npm install -g au" should be "npm install -g aurelia-cli". Sorry for confusing.