Skip to content

fix(esbuild): Don't use namespace for esbuild proxy resolving#311

Merged
lforst merged 5 commits into
mainfrom
fix-eslint
Jun 12, 2023
Merged

fix(esbuild): Don't use namespace for esbuild proxy resolving#311
lforst merged 5 commits into
mainfrom
fix-eslint

Conversation

@lforst
Copy link
Copy Markdown

@lforst lforst commented Jun 9, 2023

Potentially fixes #310

Problem was setting a custom namespace to detect that we were in fact in our proxy module. This cascaded down into user code and caused compilation errors when they were using other resolver plugins (eg. to resolve css assets).

We now instead use plugin data to detect the same thing.

@lforst lforst self-assigned this Jun 9, 2023
@lforst lforst requested review from AbhiPrasad and mydea June 12, 2023 07:18
Comment thread packages/esbuild-plugin/src/index.ts Outdated
esbuild: {
setup({ onLoad, onResolve }) {
onResolve({ filter: /.*/ }, (args) => {
onResolve({ filter: /.*/, namespace: "file" }, (args) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this? We are just hard-coding file below 😅

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, the namespace filter here is very likely unnecessary since we only want to resolve entrypoints which should only have the "file" namespace anyways (since "file" is the default).

The "passthrough" namespace below is then also unnecessary --> removed in 5c24b30

Comment thread packages/esbuild-plugin/src/index.ts Outdated
});

onLoad({ filter: /.*/, namespace: proxyNamespace }, (args) => {
onLoad({ filter: /.*/, namespace: "file" }, (args) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here, do we need namespace here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this namespace is also unnecessary. I think I defined it because I wanted to be conservative over what files we resolve/load, but thinking about it again, it seems unnecesary.

Thanks for questioning this!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lforst lforst merged commit 68472b5 into main Jun 12, 2023
@lforst lforst deleted the fix-eslint branch June 12, 2023 09:05
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

Successfully merging this pull request may close these issues.

esbuild plugin causes errors in combination with other resolver plugins

2 participants