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

[Question]: Is there support for file based entryNames? #1713

Closed
ctrl-wstrueber opened this issue Oct 26, 2021 · 4 comments
Closed

[Question]: Is there support for file based entryNames? #1713

ctrl-wstrueber opened this issue Oct 26, 2021 · 4 comments
Labels

Comments

@ctrl-wstrueber
Copy link

Hello, I am trying to figure out if there is a way to specify entryNames based on the file extension.
I would like to bundle files like:

js:
static/js/[name]-[hash]

css:
static/css/[name]-[hash]

Is there a way to set entryNames as static/[ext]/[name]-[hash] or could this be achieved in a plugin?

Thanks for any feedback

@ctrl-wstrueber
Copy link
Author

My question may have been a little vague.
I have only one entrypoint:

esbuild.build({
      ...
      entryPoints: ['src/index.tsx'],
      entryNames: 'static/js/bundle-[hash]',
});

This creates 2 files static/js/bundle-[hash].js and static/js/bundle-[hash].css.
Is there a way for me to change the location of the bundled css file?

My same question goes for assetNames

assetNames: 'static/assets/images/[name]-[hash]',

Is there a way to control assetNames by file type?
If I have a font, I would like it to be in static/assets/fonts/, not in static/assets/images/

Thanks again

@evanw
Copy link
Owner

evanw commented Oct 27, 2021

There isn't a way to do this yet, sorry. The general form of this request is #553 which I have done some work toward enabling but which I haven't enabled yet. Separately I have also considered splitting up the *Names settings by file type but doing that is a breaking change, so I haven't done this yet.

@evanw evanw added the breaking label Oct 28, 2021
@markskayff
Copy link

I'm facing the same issue.
It's a rather simple request, I mean at least in what we want to accomplish.
We want to have our bundled .js under let's say a public/js
and the resulting bundled css's under say public/css

The same goes for assets, more specifically for "file" loaded assets. These end up all below the outdir. But what if we want them somewhere else?

I have the bundle outputting to public/js/ but want my assets into public/assets/
If in the config I do: assetNames: "../assets/" ... then the bundler routes these assets with "..assets ..." in the source name and things break. And publicPath doesn't seem to help here.

@evanw
Copy link
Owner

evanw commented Mar 31, 2022

Is there a way to set entryNames as static/[ext]/[name]-[hash] or could this be achieved in a plugin?

This has already been implemented in version 0.14.2, which was released late last year. See also #1799. Closing this issue as "fixed."

@evanw evanw closed this as completed Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants