-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Feature request: Auto-include tsconfig-paths-webpack-plugin when typescript is enabled #410
Comments
Not sure, I find this interesting but I'm sceptical 🙂 Currently, optional things work like this: electron-webpack checks your package.json for certain dependencies it knows about. When it finds one, it uses that package/feature/plugin. In this case it would mean, if the user adds Default case solved, user saved two lines of config :) However, you'll need to provide options in some way. Then, we'd need to check whether it collides with existing alias features. For example what happens when user overrides some existing source aliases. Would there be duplicate keys, do we need to merge something, do we need to provide default options to that plugin to avoid problems etc. Lastly, in real-world scenarios, you will use a custom webpack config in userland anyways. For the various reasons of the given project XY.
Since it's that easy to use it, I don't think it's worth the increased complexity in the core library. You would be managing various things in your webpack config, but this one would be.. spread across several other places. There would be aliases in tsconfig, but plugin options in package.json or electron-webpack.config.js. So.. Not sure if there would be benefit in doing all that. I'd love the aliases setup to be simpler and better. And I have to try out that plugin! What do you think regarding those aspects? Maybe it's much easier and I just don't see it :) Also maybe you can just check it out and provide a PR |
I think the point is that most people want to stay on the "happy path", especially if they use something like electron-webpack (instead of a completely ejected setup), and expect So what about supporting/optimizing for the straightforward case and warn the user that they are on their own if they stray away from the happy path?
That makes the tsconfig path config support discoverable, explicit, and "standard TypeScript", so it would also integrate well with the editor's language server (vscode etc). There's no need for any additional config options. But I just realized one problem: the @ alias is different for the renderer and main targets, which is hard to support with just one tsconfig.json. |
Yeah but that |
Would it make sense to include tsconfig-paths-webpack-plugin by default if typescript is enabled so that source aliases/ path mappings work out-of-the-box? I think it's kind-of a core feature of Typescript /
tsconfig.json
so it would be nice if it "just worked".Currently you have to add this webpack config:
The text was updated successfully, but these errors were encountered: