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

[Feature] alias option for path Resolve #38

Closed
qnp opened this issue Feb 26, 2020 · 4 comments
Closed

[Feature] alias option for path Resolve #38

qnp opened this issue Feb 26, 2020 · 4 comments

Comments

@qnp
Copy link

qnp commented Feb 26, 2020

Greetings,

First of all, thanks for the wonderful work.

By the time of writing, looking at the other issues, I realize that most of the requests are based on the habits & biases that the intensive use of webpack of the past years has introduced to us – and consequently, on the existing code base we have written. And my request lie in the same category.

I tried to use esbuild on my current project that is using webpack, hop(p)ing to benefit from really faster build time, which makes the extensive use of aliases in my imports (such as '@' for path.resolve(__dirname, 'src')) which is not supported by esbuild yet.

My request is to introduce an option to define aliases.

However I would strongly understand a rejection, as esbuild would not be a Webpack written in Go 😄

Best,
François

@evanw
Copy link
Owner

evanw commented Apr 16, 2020

Thanks for logging this. It's something I do want to support, although it'll likely be in more of a data-driven way than using JavaScript code to set up the aliases, since this project isn't written in JavaScript.

Potential ways I'm considering doing this are either the alias field in package.json like Parcel does and/or the paths field in tsconfig.json for TypeScript code (see #60).

@sandeep1995
Copy link

@evanw I would like to mention that some people use jsconfig.json instead of tsconfig.json

{
    "compilerOptions": {
        "baseUrl": "./src",
        "paths": {
            "view/*": ["view/*"],
            "common/*": ["common/*"]
        }
    }
}

@evanw
Copy link
Owner

evanw commented May 22, 2020

Someone just opened a PR for jsconfig.json support: #132 (just posting here to link these two issues together).

@evanw
Copy link
Owner

evanw commented Jun 5, 2020

I think this issue can be considered fixed now that #60 has been implemented. You can now use paths in tsconfig.json or jsconfig.json to specify path aliases.

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

3 participants