Skip to content
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

Typescript Type Dependencies Not Found #50

Open
abirmingham opened this issue Sep 19, 2019 · 2 comments
Open

Typescript Type Dependencies Not Found #50

abirmingham opened this issue Sep 19, 2019 · 2 comments

Comments

@abirmingham
Copy link

Steps to Reproduce:

  1. Have a webpack 4 project with typescript.
  2. Create file TableRenderer.ts:
import { Table } from './Table';

const renderTable = (table: Table) => console.log(JSON.stringify(table));
  1. Create file Table.ts:
import * as TableRenderer from './TableRenderer';

export const renderMethods = TableRenderer;
  1. Run webpack with circular-dependency-plugin enabled.

Expected Result: Circular dependency of TableRenderer -> Table -> TableRenderer.
Actual Result: No circular dependency found.

Due to type erasure, and the circular-dependency-plugin's usage of compilation.hooks.optimizeModules, it looks like this isn't easily solvable. Perhaps there is a hook earlier in the webpack life cycle that provides dependencies prior to type erasure? I'm not sure.

@abirmingham
Copy link
Author

abirmingham commented Sep 19, 2019

Note that pahen/madge appears to avoid the issue of type erasure by parsing/checking the AST directly rather than relying on generated webpack assets (which has pros and cons). I mention it here in case someone is investigating tools to circumvent this issue.

@sionzee
Copy link

sionzee commented Jun 11, 2020

Same issue, this plugin needs better typescript support. I'm everyday watching 100+ warnings about circular dependency. (when they are not circular)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants