Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing webpack stats output #423

Open
ptrdom opened this issue May 11, 2022 · 6 comments
Open

Error parsing webpack stats output #423

ptrdom opened this issue May 11, 2022 · 6 comments

Comments

@ptrdom
Copy link
Contributor

ptrdom commented May 11, 2022

fullOptJS::webpack threw the following error for https://github.com/ptrdom/akka-http-slinky-endpoints4s:

[error] Error parsing webpack stats output
[error] /warnings(0)/moduleName: JsonValidationError(List(error.path.missing),WrappedArray())
[error] /warnings(1)/moduleName: JsonValidationError(List(error.path.missing),WrappedArray())
[error] /warnings(2)/moduleName: JsonValidationError(List(error.path.missing),WrappedArray())

JSON output was:

"warnings":[{"message":"asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).\nThis can impact web perform
ance.\nAssets: \n  clientprod-opt.109ea631b1f71d35c84e.bundle.js (622 KiB)","stack":"AssetsOverSizeLimitWarning: asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).\nThis can impact web performance.\nAssets: \n  clientprod-opt.109ea
631b1f71d35c84e.bundle.js (622 KiB)\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\performance\\SizeLimitsPlugin.js:134:7\n    at Hook.eval [a
s callAsync] (eval at create (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\tapable\\lib\\HookCodeFactory.js:33:10), <anonymous>:9:1)\n    at Hook.CALL_ASYNC_DELEG
ATE [as _callAsync] (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\tapable\\lib\\Hook.js:18:14)\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-s
linky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\Compiler.js:804:27\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\
node_modules\\neo-async\\async.js:2818:7\n    at done (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\neo-async\\async.js:3522:9)\n    at alreadyWritten (C:\\Users\
\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\Compiler.js:647:8)\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\
prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\Compiler.js:735:19\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\graceful-fs\\
graceful-fs.js:123:16\n    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)"},{"message":"entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web
 performance.\nEntrypoints:\n  clientprod-opt (622 KiB)\n      clientprod-opt.109ea631b1f71d35c84e.bundle.js\n","stack":"EntrypointsOverSizeLimitWarning: entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). 
This can impact web performance.\nEntrypoints:\n  clientprod-opt (622 KiB)\n      clientprod-opt.109ea631b1f71d35c84e.bundle.js\n\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\
\main\\node_modules\\webpack\\lib\\performance\\SizeLimitsPlugin.js:139:7\n    at Hook.eval [as callAsync] (eval at create (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_mo
dules\\tapable\\lib\\HookCodeFactory.js:33:10), <anonymous>:9:1)\n    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\ta
pable\\lib\\Hook.js:18:14)\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\Compiler.js:804:27\n    at C:\\Users\\Domantas\\IdeaProjects\\open-s
ource\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\neo-async\\async.js:2818:7\n    at done (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scala
js-bundler\\main\\node_modules\\neo-async\\async.js:3522:9)\n    at alreadyWritten (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\Compiler.js:647:8)\
n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\Compiler.js:735:19\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-end
points4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\graceful-fs\\graceful-fs.js:123:16\n    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)"},{"message":"webpack performance recommendations: 
\nYou can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\nFor more info visit https://webpack.js.org/guides/code-splitting/","stack":"NoAsyncChunksWarning: webpack performance recommendations: \nYou ca
n limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\nFor more info visit https://webpack.js.org/guides/code-splitting/\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\
\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\performance\\SizeLimitsPlugin.js:153:21\n    at Hook.eval [as callAsync] (eval at create (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod
\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\tapable\\lib\\HookCodeFactory.js:33:10), <anonymous>:9:1)\n    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\
\scala-2.13\\scalajs-bundler\\main\\node_modules\\tapable\\lib\\Hook.js:18:14)\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\Compiler.js:804:
27\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\neo-async\\async.js:2818:7\n    at done (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-
endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\neo-async\\async.js:3522:9)\n    at alreadyWritten (C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\m
ain\\node_modules\\webpack\\lib\\Compiler.js:647:8)\n    at C:\\Users\\Domantas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\webpack\\lib\\Compiler.js:735:19\n    at C:\\Users\\Doman
tas\\IdeaProjects\\open-source\\akka-http-slinky-endpoints4s\\client\\prod\\target\\scala-2.13\\scalajs-bundler\\main\\node_modules\\graceful-fs\\graceful-fs.js:123:16\n    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
"}]

Seems like moduleName not a mandatory field for warnings in Webpack 5. Relatively simple change.

final case class WebpackWarning(moduleName: String, message: String)

@ptrdom
Copy link
Contributor Author

ptrdom commented May 11, 2022

There is a really old unmerged PR that solves this - #408.

@evbo
Copy link

evbo commented May 14, 2022

@ptrdom I am similarly getting an error due to loc in WebpackError being optional as well. I think this was caused by the JS library weeknumber (1.2.1) having some funny errors with loc (the line number of the error) missing because I didn't have this happen until I added it as a dependency.

According to the docs, WebPack only mentions message and refers to all other fields as "various" (does that mean they "vary" in existence and should be optional?):
https://webpack.js.org/api/stats/#errors-and-warnings

My error is resolved with this addition to your PR:

final case class WebpackError(moduleName: Option[String], message: String, loc: Option[String])

@ptrdom
Copy link
Contributor Author

ptrdom commented May 15, 2022

@evbo Good eye, I did not spot that in docs. I will implement your suggestion. Maybe adding the stack trace would be a good idea too.

@cornerman
Copy link

I am currently hitting this issue when upgrading to the new version with webpack 5. Indeed, there are warnings without a moduleName as already mentioned. Is anything blocking the linked PR?

@evbo
Copy link

evbo commented Nov 23, 2022

@cornerman I don't mean to speak for everyone, as I know webpack is still one of the most popular bundlers, but Vite has sort of taken the bundling world by storm! I think many people using Scalajs use Vite, and hence scalajs-bundler might not be getting as much love as it used to.

I know this may be off-topic or counter-productive, but if you can bite the bullet, I migrated to Vite within a day for a fairly large project. And I'm never looking back...

Sjs did an amazing job presenting, so it's a breeze :)
https://www.youtube.com/watch?v=dv7fPmgFTNA

I hope this helps...

@cornerman
Copy link

cornerman commented Nov 23, 2022

@evbo Thanks for sharing your good experience with vite and the video. I want to look into vite, but did not find the time yet.

For now updating to webpack 5 seemed a bit faster. My current workaround is using ignoreWarning in my webpack config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants