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

The module @web/dev-server-esbuild does not seem to observe the paths definition in tsconfig.json #2837

Open
doberkofler opened this issue Oct 27, 2024 · 0 comments

Comments

@doberkofler
Copy link

I'm currently testing the Moden web test Runner and trying to use @web/dev-server-esbuild to build my tests written in TypeScript. Unfortunately it seems as if the import alias defined in @web/dev-server-esbuild are not properly processed.

{
	"compilerOptions": {
		"target": "ESNext",
		"module": "ESNext",
		"moduleResolution": "node",
		"strict": true,
		"esModuleInterop": true,
		"skipLibCheck": true,
		"allowSyntheticDefaultImports": true,
		"types": ["@playwright/test", "mocha", "chai"],
		"paths": {
			"@alias_root/*": ["./*"]
		}
	},
	"include": ["**/*.ts"]
}

A quick look into the source code of @web/dev-server-esbuild suggests that the function resolveImport in EsbuildPlugin.ts skips to entirely process all files that does not start with . to only handle relative imports, but does this before having resolved the alias and therefore missing the import using an alias.

    if (!source.endsWith('.js') || !source.startsWith('.')) {
      // only handle relative imports
      return;
    }
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

1 participant