Talend / ui

Talend's unified web UI repository.
https://talend.github.io/ui/main/
Apache License 2.0
153 stars 55 forks source link

dynamic-cdn-webpack-plugin compatibility with tsconfig "paths" #4217

Closed Triazic closed 1 year ago

Triazic commented 2 years ago

Is your feature request related to a problem? Please describe. My project uses tsconfig "paths" feature. When using this package, all of those paths get picked up as external packages and throw spammy errors in the build logs:
image The 'exclude' feature doesn't seem to work for this purpose. I've tried eg. "@state/*", "@state/", "@state"

My tsconfig:
image

Describe the solution you'd like Option 1 - ability to disable those particular error messages Option 2 - automatic support for tsconfig paths Option 3 - chained support with tsconfig-paths-webpack-plugin Option 4 - exclude feature supporting wildcards ??

Triazic commented 2 years ago

I could create a custom resolver that ignores those paths and falls back to @talend/module-to-cdn, I suppose

jmfrancois commented 2 years ago

interesting issue indeed. As you can see here module exclusion is evaluated this way

        const isModuleExcluded =
            this.exclude.includes(modulePath) ||
            (this.only && !this.only.includes(modulePath)) ||
            modulePath.startsWith('@types/');

I do not think custom resolver will help because it happens after this code. So I would tend to think you should add excludeScope feature so you could pass it using configuration and add exlucdeScope: ['@components', '@whateverscope', ...].

At webpack level we do not have access to TS configuration, the code has already been parsed.

jmfrancois commented 1 year ago

do not hesitate to re-open if you want to contribute and propose a fix on our side. I close it as stale.