-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
ts-loader concatenates all dependencies instead of only needed ones #886
Comments
I'm assuming it's tree shaking you're after? That's more webpack specific than ts-loader specific. I'm not aware of any issues around ts-loader in what you've said. See #453 You may need to pipe to babel |
@johnnyreilly I don't need babel, because I need TS to be compiled to pure ES6 code without support of old browsers. |
You can do that with Babel! You choose how far back you want to transpile |
@johnnyreilly I understand, but doesn't ts-loader already transpiling my code? And if tree-shaking is a webpack feature, then how's babel even related to all this? |
It does - but you can target the version of ecmascript you choose and let Babel do it's thing. I'm no expert on tree shaking I'm afraid; you'll have to ask elsewhere.. |
@johnnyreilly Okay, i'll try to use it in the way you suggest. Thank you. |
Had some problems too. You are using the wrong module system. From Webpack documentation:
|
@Bellian It seems like the webpack docs was updated after the issue itself was created :) |
ts-loader concatenates all dependencies instead of only needed ones.
Example:
Webpack config
tsconfig.json
Expected Behaviour
Imports only
const test
. Small bundle size.Actual Behaviour
It imports everything from imports list in
module.ts
. Huge bundle size.BundleAnalyzerPlugin output
The text was updated successfully, but these errors were encountered: