Using less-loader to compile less,css-loader error report

problem description

an error trying to use less-loader Times shows that an error occurred in css-loader and that @ babel/preset-env was not found.

clipboard.png

the platform version of the problem and what methods you have tried

install babel-preset-env, add env to babel"s presets, and still show @ babel/preset-env not found

related codes

/ / Please paste the code text below (do not replace the code with pictures)
/ / .babelrc

// less
import less from "./main.less";
May.17,2022

this is due to the mismatch between the versions of babel-preset-env and less-loader. The latest version of less-loader relies on @ babel/preset-env instead of babel-preset-env. You should be careful when installing using npm.
when using the latest babel-loader, when installing with npm, it should be the following corresponding version:
babel-core corresponds to @ babel/core
babel-plugin-transform-runtime corresponds to @ babel/plugin-transform-runtime and @ babel/runtime
at this time, the .babelrc setting is:

  

.babelrc file needs to be modified:
"presets": ["@ babel/preset-env"]

Menu