我的browserslist文件是
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11
当运行ng build
时,它会抛出一个警告,说Angular CLI不支持ES5输出。
所以我按照this answer的建议,在browserslist中添加了以下行:
supports es6-module
但是Webpack抛出了无效版本错误(tp.0) 日志:
[error] HookWebpackError: Transform failed with 1 error:
error: Invalid version: "tp.0"
at makeWebpackError (C:\Users\manna\Desktop\AngularProjects\angular-config\node_modules\webpack\lib\HookWebpackError.js:48:9)
at C:\Users\manna\Desktop\AngularProjects\angular-config\node_modules\webpack\lib\Compilation.js:3060:12
at eval (eval at create (C:\Users\manna\Desktop\AngularProjects\angular-config\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:115:1)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
-- inner error --
Error: Transform failed with 1 error:
error: Invalid version: "tp.0"
at failureErrorWithLog (C:\Users\manna\Desktop\AngularProjects\angular-config\node_modules\esbuild\lib\main.js:1604:15)
at C:\Users\manna\Desktop\AngularProjects\angular-config\node_modules\esbuild\lib\main.js:837:29
at responseCallbacks.<computed> (C:\Users\manna\Desktop\AngularProjects\angular-config\node_modules\esbuild\lib\main.js:701:9)
at handleIncomingPacket (C:\Users\manna\Desktop\AngularProjects\angular-config\node_modules\esbuild\lib\main.js:756:9)
at Socket.readFromStdout (C:\Users\manna\Desktop\AngularProjects\angular-config\node_modules\esbuild\lib\main.js:677:7)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)