Skip to content

Commit

Permalink
chore: import webpack using "* as webpack" syntax (#780)
Browse files Browse the repository at this point in the history
Avoids problems like the following:

```
$ npx tsc
node_modules/fork-ts-checker-webpack-plugin/lib/plugin.d.ts:1:13 - error TS1259: Module '".../node_modules/webpack/types"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

1 import type webpack from 'webpack';
              ~~~~~~~

  node_modules/webpack/types.d.ts:13189:1
    13189 export = exports;
          ~~~~~~~~~~~~~~~~~
    This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

Found 1 error in node_modules/fork-ts-checker-webpack-plugin/lib/plugin.d.ts:1
```
  • Loading branch information
lrworth authored Oct 29, 2023
1 parent d461689 commit 510bde4
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/hooks/intercept-done-to-get-dev-server-tap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import { getInfrastructureLogger } from '../infrastructure-logger';
import type { ForkTsCheckerWebpackPluginConfig } from '../plugin-config';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/tap-after-compile-to-add-dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import { getInfrastructureLogger } from '../infrastructure-logger';
import type { ForkTsCheckerWebpackPluginConfig } from '../plugin-config';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/tap-after-compile-to-get-issues.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import { getInfrastructureLogger } from '../infrastructure-logger';
import type { Issue } from '../issue';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/tap-after-environment-to-patch-watching.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import { getInfrastructureLogger } from '../infrastructure-logger';
import type { ForkTsCheckerWebpackPluginState } from '../plugin-state';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/tap-done-to-async-get-issues.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from 'chalk';
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import { statsFormatter } from '../formatter/stats-formatter';
import { createWebpackFormatter } from '../formatter/webpack-formatter';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/tap-error-to-log-message.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from 'chalk';
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import type { ForkTsCheckerWebpackPluginConfig } from '../plugin-config';
import { getPluginHooks } from '../plugin-hooks';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/tap-stop-to-terminate-workers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import { getInfrastructureLogger } from '../infrastructure-logger';
import type { ForkTsCheckerWebpackPluginState } from '../plugin-state';
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure-logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type webpack from 'webpack';
import type * as webpack from 'webpack';

export interface InfrastructureLogger {
log(...args: unknown[]): void;
Expand Down
2 changes: 1 addition & 1 deletion src/issue/issue-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import { createIssuePredicateFromIssueMatch } from './issue-match';
import type { IssuePredicateOption, IssueOptions } from './issue-options';
Expand Down
2 changes: 1 addition & 1 deletion src/issue/issue-webpack-error.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';

import chalk from 'chalk';
import webpack from 'webpack';
import * as webpack from 'webpack';

import type { FormatterPathType } from '../formatter';
import { forwardSlash } from '../utils/path/forward-slash';
Expand Down
2 changes: 1 addition & 1 deletion src/plugin-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import type { FormatterConfig } from './formatter';
import { createFormatterConfig } from './formatter';
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { cosmiconfigSync } from 'cosmiconfig';
import merge from 'deepmerge';
import type { JSONSchema7 } from 'json-schema';
import { validate } from 'schema-utils';
import type webpack from 'webpack';
import type * as webpack from 'webpack';

import { tapAfterCompileToAddDependencies } from './hooks/tap-after-compile-to-add-dependencies';
import { tapAfterEnvironmentToPatchWatching } from './hooks/tap-after-environment-to-patch-watching';
Expand Down
2 changes: 1 addition & 1 deletion src/typescript/type-script-worker-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';

import type webpack from 'webpack';
import type * as webpack from 'webpack';

import type { TypeScriptConfigOverwrite } from './type-script-config-overwrite';
import type { TypeScriptDiagnosticsOptions } from './type-script-diagnostics-options';
Expand Down
2 changes: 1 addition & 1 deletion src/watch/watch-file-system.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { EventEmitter } from 'events';

import type webpack from 'webpack';
import type * as webpack from 'webpack';

// watchpack v1 and v2 internal interface
interface Watchpack extends EventEmitter {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/typescript/type-script-worker-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';

import type { TypeScriptWorkerConfig } from 'src/typescript/type-script-worker-config';
import type { TypeScriptWorkerOptions } from 'src/typescript/type-script-worker-options';
import type webpack from 'webpack';
import type * as webpack from 'webpack';

describe('typescript/type-scripts-worker-config', () => {
let compiler: webpack.Compiler;
Expand Down

0 comments on commit 510bde4

Please sign in to comment.