Talend/ui

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

Triazic opened this issue · 3 comments

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
??

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

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.

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