qwik icon indicating copy to clipboard operation
qwik copied to clipboard

feat(vite-plugin): set assets path in build to /assets

Open wmertens opened this issue 1 year ago • 7 comments

Right now, if rollupOptions.output.assetFilenames is not defined, assets will be output as build/q-[hash].ext.

This PR changes that default setting to assets/[hash].[ext].

The reasoning is that for post-processing like $localize that copies the build files into /build/[locale]/, it makes no sense to have to copy .css files and others, especially since all css files will be automatically added to the head and so you'll get a per-language copy of the css file.

This is a slightly breaking change, in case some custom scripting is expecting all files to live under /build. (Seems unlikely though)

wmertens avatar Jan 21 '24 21:01 wmertens

Deploy Preview for qwik-insights ready!

Name Link
Latest commit 9ec0384f7ce4cfbd584a725818bd3cd2db4b7561
Latest deploy log https://app.netlify.com/sites/qwik-insights/deploys/65bf5c5c781d5a00081cdf35
Deploy Preview https://deploy-preview-5745--qwik-insights.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jan 21 '24 21:01 netlify[bot]

Deploying qwik-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 70cfaaa
Status: ✅  Deploy successful!
Preview URL: https://dcbf3e14.qwik-8nx.pages.dev
Branch Preview URL: https://build-assets-path.qwik-8nx.pages.dev

View logs

oh I actually need this change haha

PatrickJS avatar Jan 28 '24 20:01 PatrickJS

@PatrickJS you can configure this for yourself, it just changes the default

wmertens avatar Jan 28 '24 22:01 wmertens

yeah I see that now 😂 I'll update on my end. plus I also want to keep the names for the assets the same for SEO. It's good to fix this as the default

PatrickJS avatar Jan 29 '24 00:01 PatrickJS

@wmertens I want to move all assets to another folder. so dist/client and dist/assets and dist/server

the idea is that I may want to handle assets differently or uploaded somewhere else. I can configure dist/client and dist/server

PatrickJS avatar Jan 31 '24 04:01 PatrickJS

for SEO reasons you want to keep the name of the file so I changed it to this for my app

assetFileNames: 'assets/[hash]/[name][extname]'

it also helps to see which fonts are loading in

PatrickJS avatar Feb 13 '24 06:02 PatrickJS

for images we want to keep the image name for seo so assets/[hash]/[name][extname] is a better way to include the hash for caching. we also need to make sure the headers are set to immutable for /assets like we do or /build

PatrickJS avatar May 01 '24 00:05 PatrickJS

for images we want to keep the image name for seo so assets/[hash]/[name][extname]

how about assets/[hash]-[name][extname] so that we don't create a zillion directories?

wmertens avatar May 01 '24 09:05 wmertens

@wmertens yup that works

PatrickJS avatar May 01 '24 18:05 PatrickJS

I updated the pr

PatrickJS avatar May 06 '24 04:05 PatrickJS

for v1 can we do assetFileNames: 'build/assets/[hash]-[name][extname]'

PatrickJS avatar May 19 '24 17:05 PatrickJS

🦋 Changeset detected

Latest commit: f3c69ac399ddfc3d8aa5f744f62608bf9dc61886

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@builder.io/qwik Minor
eslint-plugin-qwik Minor
@builder.io/qwik-city Minor
create-qwik Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jul 30 '24 10:07 changeset-bot[bot]

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview f3c69ac399ddfc3d8aa5f744f62608bf9dc61886

github-actions[bot] avatar Jul 30 '24 10:07 github-actions[bot]

commit: f3c69ac

npm i https://pkg.pr.new/@builder.io/qwik@5745
npm i https://pkg.pr.new/@builder.io/qwik-city@5745
npm i https://pkg.pr.new/eslint-plugin-qwik@5745
npm i https://pkg.pr.new/create-qwik@5745

Open in Stackblitz

pkg-pr-new[bot] avatar Jul 30 '24 22:07 pkg-pr-new[bot]