0

webpack-cli provides the --plugin option but it seems it can not resolve the ProfilingPlugin.

is there any way to use it directly through the cli options without creating a webpack config?

node_modules/.bin/webpack --mode=production --progress --profile --plugin ProfilingPlugin Cannot resolve plugin ProfilingPlugin

https://webpack.js.org/api/cli/#advanced-options

--plugin Load this plugin

https://webpack.js.org/configuration/plugins/

This table does not list a ProfilingPlugin but it is internally available.

1 Answers1

0

webpack --plugin webpack/lib/debug/ProfilingPlugin

This works since each argument to --plugin is a node module to require, and so should be a path that obeys node's resolution rules.

Here's how you can test this:

#! /bin/env sh
# set up a test directory
mkdir temp && cd temp && mkdir src/ && touch src/index.js
cat "export default 'foo'" > src/index.js
npm i webpack webpack-cli
node_modules/.bin/webpack --plugin webpack/lib/debug/ProfilingPlugin
ls -al | grep events.json
Steven Kalt
  • 1,116
  • 15
  • 25