-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
resolveTypeReferenceDirective support for yarn PnP #921
Conversation
Awesome 👍 |
First question: The PnP docs point you here: https://github.com/arcanis/pnp-webpack-plugin#ts-loader-integration Which suggests you should use the const PnpWebpackPlugin = require(`pnp-webpack-plugin`);
module.exports = {
module: {
rules: [{
test: /\.ts$/,
loader: require.resolve('ts-loader'),
options: PnpWebpackPlugin.tsLoaderOptions(),
}],
},
}; In fact
So it looks like we should be using That being the case, It looks like a tweak may be required here: module.exports.tsLoaderOptions = (options = {}) => pnp ? Object.assign({}, options, {
resolveModuleName: require('ts-pnp').resolveModuleName,
}) : options; To add in Does that sound right? Also, I'm guessing using Otherwise you would have to manually supply this option to
Do I have this about right? |
Yep - although my warning in The wording is mostly intended for average users, which don't really care much about the setup of TS and PnP and just want something that work out of the box. In their case they can just use |
Hey @arcanis, I've implemented what I think makes sense based on our conversation. Do you want to take a quick glance and let me know if I'm headed roughly in the right direction? There's a bit of noise in the |
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.
Looks good to me from an implem standpoint!
@@ -137,30 +153,81 @@ export function makeServicesHost( | |||
trace: log.log, | |||
log: log.log, | |||
|
|||
/* Unclear if this is useful |
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.
Eheh it was 😅
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.
I know, right? How could I imagine a comment like that wouldn't come back to bite me 😄
This PR should (when completed) add
resolveTypeReferenceDirective
support to ts-loader to complement the existingresolveModuleName
added by @arcanis in #862 which was added to support yarn PnP.Other inspiration: TypeStrong/fork-ts-checker-webpack-plugin#250
I've a number of questions which I'm hoping people can advise on. I'd like to use this PR to go through these as I think the answers to them will be a generally useful resource in future.
Heads up: I have never used PnP before, but I'm excited the possibilities it may provide. I think it's somewhat useful that I don't know tons about it as the questions I ask will likely be the sorts of things that others wonder about too.
I hope this is cool with you @arcanis?
So this PR should be a combination of discussion and then implementation informed by the discussion.