Skip to content

Update TypeScript configuration example to TS 2.7 #1926

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

Merged
merged 1 commit into from
Mar 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/content/configuration/configuration-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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:
Expand Down