R
R
resibe2021-11-29 03:17:42
webpack
resibe, 2021-11-29 03:17:42

How to script npx webpack --profile --json=compilation-stats.json?

Hello, if with webpack-cli installed yarn add webpack-cli --dev
use

npx webpack --profile --json=compilation-stats.json
you get a json-chip that can be analyzed for speed https://webpack.github.io/analyse/
the command works fine when copied to the console, but when
//package.json
  "scripts": {
 "profile": "npx webpack --profile --json=compilation-stats.json",
}

Using
"profile": "webpack --profile --json=compilation-stats.json",
same error
when running yarn profile :
yarn profile
yarn run v1.22.17
warning ..\package.json: No license field
$ cross-env NODE_ENV=production webpack --profile --json=profile/profile.txt
[webpack-cli] stats are successfully stored as json to profile/profile.txt
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
- the file is created, analyzed and everything works, but why does it write in the console that something is wrong, although everything seems to be normal ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2021-11-29
@resibe

If you have webpack as a dependency, you don't need to use npx in the scripts section command.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question