-
Notifications
You must be signed in to change notification settings - Fork 2
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
Seeking community feedback on this plugin #5
Comments
I'm not knowledgeable enough about resolvers to speak to the second item, and while it would be nice to have built into common configs using ts-loader or babel-loader with the typescript plugin, I think it's fine having it in a separate plugin as long as it's visible and documented somewhere. As for the other items, I am currently using a private dependency that currently intentionally publishes
I believe it will if you tell it to in I plan on putting something together and submitting a PR to opt out of the Thanks for putting this plugin together! It saved me from an annoying headache at 5:30pm on a Friday before a long holiday weekend! 😄 |
I'm glad this helped you!
Good point, I'm wondering if the plugin should read |
Pinging microsoft/TypeScript#16577 in the hope that people who need this plugin will see it. |
@djcsdy does this plugin work with webpack 4 as well? |
trying to get it implemented here: storybookjs/storybook#15973 |
@lifeiscontent it should do, although I haven't tested it. If not please file a bug. |
thanks for your work on this plugin. it helped me in my storybook webpack setup |
I would also like to leave a word of thanks here. I can't believe the behaviour that this plugin adds isn't provided by default in webpack as it seems like such a common problem to me. Though the automagical In my use case, I've been using TypeORM which provides both a programmatic interface as well as a CLI to interact with the ORM/database entities. Both use the same files and as my project is bundled with webpack, they are incompatible with each other. The CLI runs on (ts-)node which expects ESM compatibility with full file extensions in imports while webpack explodes when trying to find TypeScript files as Its like trying to please three divas at once and one is always complaining no matter what. I've found that you can workaround it by either adding |
This functionality is now built in to webpack, see https://github.com/softwareventures/resolve-typescript-plugin#obsolete |
This plugin works by inserting itself into the resolution process, and whenever webpack is resolving a file ending in
.js
, the plugin tries.ts
and then.tsx
first, and then continues with the usual process if those files don't exist. This plugin ignores files withinnode_modules
so those files are resolved as normal with no alteration to the file extension.I'm not sure of my approach and I'm seeking community feedback, so if anyone interested in this problem could take a look and let me know what they think I'd really appreciate it.
In particular:
node_modules
)? At the moment the plugin skips over any request wherenode_modules
appears as a part of the path, but I'm not really happy with this. Apart from being a hack, the current solution has the obvious problem that it doesn't work if external libraries are in a directory other thannode_modules
, and it doesn't work if the project you're building is itself in anode_modules
hierarchy (I can imagine use cases for doing this). Ideally I think I'd like to ignore any request that has passed throughModulesInHierachicDirectoriesPlugin
at any point, but I can't see a good way to do this..ts
files on npm in addition to the compiled.js
files, for use with source maps, and it's desirable for webpack to resolve the.js
files and not the.ts
files in this case. TypeScript itself won't compile source files resolved fromnode_modules
when you compile withtsc
.The text was updated successfully, but these errors were encountered: