diff --git a/src/content/guides/typescript.md b/src/content/guides/typescript.md index cf7970c57a54..ae5c62e22010 100644 --- a/src/content/guides/typescript.md +++ b/src/content/guides/typescript.md @@ -118,6 +118,9 @@ T> To make imports do this by default and keep `import _ from 'lodash';` syntax We use `ts-loader` in this guide as it makes enabling additional webpack features, such as importing other web assets, a bit easier. +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). + +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. ## Source Maps