fix: Use correct stage for adding assets during compilation#1286
fix: Use correct stage for adding assets during compilation#1286johnnyreilly merged 1 commit intoTypeStrong:mainfrom JonWallsten:add-correct-compilation-hook
Conversation
|
@johnnyreilly: I extracted the fix from my previous webpack 5 branch and added on top of the v5. Seems to work fine! |
| compilation.hooks.processAssets.tap( | ||
| { | ||
| name: 'ts-loader', | ||
| stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, |
There was a problem hiding this comment.
What's the significance of the specified stage @JonWallsten?
There was a problem hiding this comment.
"add additional assets to the compilation." I guess?
There was a problem hiding this comment.
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.
Yep, it is right usage, we can implement cache here in future
|
Cool - do you want to update the |
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.