-
Notifications
You must be signed in to change notification settings - Fork 33
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
WIP: upgrade to Webpack 5 #34
base: master
Are you sure you want to change the base?
Conversation
This is deprecated in favor of |
The typings are a bit incomplete here, but the JSON data is mostly the same except for a few minor changes. |
hey justin 👋 the vue stuff is broken because the svelte rule is matched by the vue plugin, which breaks the loop and never reaches the vue rule. the plugin iterates through all the rules. for each rule, it tests it against switching them around might fix it but feels a bit delicate, easy to break again if someone isn't aware of this behaviour i suppose really its a bug in vue-loader in that it shouldn't break the loop until it finds a vue-loader rule, if ever. |
|
||
return new Promise<CompilePackageReturn>(resolve => { | ||
compiler.run((err, stats) => { | ||
const error = (err as unknown) as WebpackError // Webpack types incorrect | ||
// stats object can be empty if there are build errors | ||
resolve({ stats, error, memoryFileSystem }) | ||
resolve({ stats: stats!, error, memoryFileSystem }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stats
can be empty if there was an error FYI
also the test fails for some unrelated error right now:
Which also reveals that we have a problem here: package-build-stats/src/utils/build.utils.ts Lines 194 to 221 in 1077b78
you can see at the bottom we check if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error: Conflict: Multiple chunks emit assets to the same filename bundle.js (chunks main and runtime)
This is caused by output.filename: 'bundle.js'
. Better use the default output.filename: "[name].js"
otherwise the main
entry and runtime
runtimeChunk, will lead to the same filename bundle.js
.
// comments: false, | ||
// }, | ||
// }, | ||
// }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can reference the default (terser) with "..."
in webpack 5.
|
That's fixed now |
i can try pick this up if you don't have time @justinfagnani @sokra webpack5 has its own types now i see, but it doesn't export quite a few of the interfaces it uses. for example, the changes justin has here need |
I definitely don't have time right now, so that'd be great @43081j ! I guess it'd be nice to file issues/PRs on Webpack to export the type interfaces needed here. |
No worries, I'll have a go at finishing it off. Also have opened a PR at definitelytyped to update the mini-css plugin so you don't have to cast it as any. Will see if I can get that done first |
Addresses #33
I took a crack at upgrading, but I really don't know Webpack well, so I got stuck in a few places. Opening this PR in case a few of the things I got right make for a useful starting point.
Two things that are tricky:
webpack.Stats.ToJsonOutput
.webpack.Stats
is a class with atoJson()
method, but I don't see any types for it's output. There are JSON schema files, so maybe it's expected to consume one of those? I tried to use the JS interface withstats.compilation
, but I'm not sure if that's working yet.any
for now.