aurelia / cli

The Aurelia 1 command line tool. Use the CLI to create projects, scaffold components, and bundle your app for release.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

HIRANO-Satoshi opened this issue · comments

I'm submitting a bug report

  • Library Version:
    aurelia-cli 2.0.3 (latest)

Please tell us about your environment:

  • Operating System:
    OSX 11.6.2

  • Node Version:
    v17.4.0 (latest)

  • NPM Version:
    8.3.1 (latest)

  • Language:
    All

  • Loader/bundler:
    Webpack 5

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)

  • What is the expected behavior?

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');

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.

mini-css-extract-plugin had a breaking change in v2.5.0, aurelia/v1@caf5af7

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

Fixed.

@3cp 3cp, thanks for quick fix.

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