diff --git a/src/content/configuration/configuration-languages.md b/src/content/configuration/configuration-languages.md index a3ac2379200f..f9f4d4f3413b 100644 --- a/src/content/configuration/configuration-languages.md +++ b/src/content/configuration/configuration-languages.md @@ -26,8 +26,8 @@ and then proceed to write your configuration: __webpack.config.ts__ ```typescript -import * as webpack from 'webpack'; -import * as path from 'path'; +import path from 'path'; +import webpack from 'webpack'; const config: webpack.Configuration = { entry: './foo.js', @@ -40,6 +40,8 @@ const config: webpack.Configuration = { export default config; ``` +Above sample assumes version >= 2.7 or newer of TypeScript is used with the new `esModuleInterop` and `allowSyntheticDefaultImports` compiler options in your `tsconfig.json` file. + Note that you'll also need to check your `tsconfig.json` file. If the module in `compilerOptions` in `tsconfig.json` is `commonjs`, the setting is complete, else webpack will fail with an error. This occurs because `ts-node` does not support any module syntax other than `commonjs`. There are two solutions to this issue: