Webpack-cli: Unknown argument: --config-register

Created on 12 Oct 2020  ยท  6Comments  ยท  Source: webpack/webpack-cli

Describe the bug

I can't register @babel/register with the following command
webpack --config-register @babel/register

What is the current behavior?

It returns following output

> webpack --config-register @babel/register "-w"

[webpack-cli] Unknown argument: --config-register
[webpack-cli] Unknown argument: @babel/register
? Which flags do you want to use? โ€ฆ
โœ” --entry: The entry point(s) of your application e.g. ./src/main.js
โœ” --config: Provide path to a webpack configuration file e.g. ./webpack.config.js
โœ” --color: Enable/Disable colors on console
โœ” --merge: Merge two or more configurations using webpack-merge e.g. -c ./webpack.config.js -c ./webpack.test.config.js --merge
โœ” --progress: Print compilation progress during build
โœ” --help: Outputs list of supported flags
โœ” --output-path: Output location of the file generated by webpack e.g. ./dist/
โœ” --target: Sets the build target e.g. node
โœ” --watch: Watch for files changes
โœ” --hot: Enables Hot Module Replacement
โœ” --devtool: Determine source maps to use
โœ” --prefetch: Prefetch this request
โœ” --json: Prints result as JSON or store it in a file
โœ” --mode: Defines the mode to pass to webpack
โœ” --version: Get current version
โœ” --stats: It instructs webpack on how to treat the stats e.g. verbose
โœ” --env: Environment passed to the configuration when it is a function
โœ” --name: Name of the configuration. Used when loading multiple configurations.
โœ” --config-name: Name of the configuration to use

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'package.json' file
  2. Add a new script with "webpack --config-register @babel/register"
  3. Open the terminal and run the script
  4. See the warning

Expected behavior


It should start executing webpack with no problem

Screenshots

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

  System:
    OS: Linux 4.19 Ubuntu 20.04 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 1.31 GB / 4.82 GB
  Binaries:
    Node: 12.18.1 - ~/.nvm/versions/node/v12.18.1/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v12.18.1/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v12.18.1/bin/npm
  Packages:
    tsconfig-paths-webpack-plugin: ^3.3.0 => 3.3.0
    webpack: ^5.0.0 => 5.0.0
    webpack-cli: ^4.0.0 => 4.0.0
    webpack-extension-reloader: ^1.1.4 => 1.1.4
    webpack-watched-glob-entries-plugin: ^2.1.7 => 2.1.7

Additional context

Bug

Most helpful comment

@juwens I believe it was removed without replacement.
Though if you find this is something that should be supported feel free to open a new issue about it with your use case.

All 6 comments

@seahindeniz webpack-cli v4 doesn't support --config-register, you can see available options & commands here https://github.com/webpack/webpack-cli/tree/master/packages/webpack-cli#supported-arguments-and-commands

Hmm, thank you @snitin315

@snitin315 or @seahindeniz can you please say which parameter replaced --config-register.
Because i don't see any equivalent.

Hey @juwens

I use --config-register to register babel to be able to use ES6 stuff on the config file. After @snitin315's message, I simply switched from JS config file to TS.

Here, you can check my config from my repo
https://github.com/seahindeniz/BrainlyTools_Extension/blob/master/webpack.config.ts

https://github.com/seahindeniz/BrainlyTools_Extension/blob/master/package.json#L165

@juwens I believe it was removed without replacement.
Though if you find this is something that should be supported feel free to open a new issue about it with your use case.

Yes, we support ts/babel/etc files without extra options

Was this page helpful?
0 / 5 - 0 ratings

Related issues

larkintuckerllc picture larkintuckerllc  ยท  5Comments

heyalbert picture heyalbert  ยท  3Comments

AjayPoshak picture AjayPoshak  ยท  5Comments

sumukhah picture sumukhah  ยท  3Comments

evenstensberg picture evenstensberg  ยท  5Comments