Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
HIRANO-Satoshi opened this issue Jan 19, 2022 · 4 comments

Comments

@HIRANO-Satoshi
Copy link

HIRANO-Satoshi commented Jan 19, 2022

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

@3cp
Copy link
Member

3cp commented Jan 19, 2022

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
Copy link
Member

3cp commented Jan 19, 2022

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.

@3cp
Copy link
Member

3cp commented Jan 19, 2022

Fixed.

@3cp 3cp closed this as completed Jan 19, 2022
@HIRANO-Satoshi
Copy link
Author

@3cp 3cp, thanks for quick fix.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants