Skip to content

Commit 1a42041

Browse files
authored
docs(guides): update Loader section (#4189)
* feat: update Loader section This adds a warning with some possibly unknown side-effects of `ts-loader`, and adds a note on how Babel can replace it altogether with the right preset or plugin. * fix: add missing word
1 parent 0a082b9 commit 1a42041

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/content/guides/typescript.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ T> To make imports do this by default and keep `import _ from 'lodash';` syntax
118118

119119
We use `ts-loader` in this guide as it makes enabling additional webpack features, such as importing other web assets, a bit easier.
120120

121+
W> `ts-loader` uses `tsc`, the TypeScript compiler, and relies on your `tsconfig.json` configuration. Make sure to avoid setting [`module`](https://www.typescriptlang.org/tsconfig#module) to "CommonJS", or webpack won't be able to [tree-shake your code](/guides/tree-shaking).
122+
123+
Note that if you're already using [`babel-loader`](https://github.com/babel/babel-loader) to transpile your code, you can use [`@babel/preset-typescript`](https://babeljs.io/docs/en/babel-preset-typescript) and let Babel handle both your JavaScript and TypeScript files instead of using an additional loader. Keep in mind that, contrary to `ts-loader`, the underlying [`@babel/plugin-transform-typescript`](https://babeljs.io/docs/en/babel-plugin-transform-typescript) plugin does not perform any type checking.
121124

122125
## Source Maps
123126

0 commit comments

Comments
 (0)