-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
fix: Use correct stage for adding assets during compilation #1286
fix: Use correct stage for adding assets during compilation #1286
Conversation
4816d1a
to
d45e452
Compare
@johnnyreilly: I extracted the fix from my previous webpack 5 branch and added on top of the v5. Seems to work fine! |
d45e452
to
4f766ed
Compare
compilation.hooks.processAssets.tap( | ||
{ | ||
name: 'ts-loader', | ||
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, |
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.
What's the significance of the specified stage @JonWallsten?
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.
"add additional assets to the compilation." I guess?
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.
This is just the preferred way of doing it in Webpack 5. @alexander-akait metioned it in the beginning of the big PR. It shouldn't affect anything at all. It's just more future proof.
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.
Yep, it is right usage, we can implement cache here in future
Cool - do you want to update the |
4f766ed
to
60e6c7e
Compare
Done! |
@JonWallsten We can avoid using
https://github.com/TypeStrong/ts-loader/blob/main/src/index.ts#L649, just change on:
Because webpack v5 is minimum supported version, no breaking changes here, just less code and less deps |
Hey @alexander-akait Are you saying that const loaderOptions =
loaderUtils.getOptions<LoaderOptions>(loaderContext) ||
({} as LoaderOptions); can become const loaderOptions = this.getOptions(); // schema is optional ? |
Yes |
I can do a PR if you'd like @johnnyreilly! |
No description provided.