Comments (10)
Dealing with this after the 0.7.0 release. firien's fix works, but given that chunks/[name]-[hash] is the standard example in the esbuild docs, I expect a fair number of people are going to end up here, wondering what happened. If there's no good way to fix this in propshaft, I'd say it would be worth documenting the above fix (and maybe printing a warning when the gem is updated).
from propshaft.
Thanks for the report. I have a large app running esbuild and propshaft, so I’ll apply chunking to it and see what I can do to fix this.
from propshaft.
@brenogazzola - the "issue" is that esbuild creates many files named chunk-[hash]
and propshaft will resolve that to 1 logical path: chunk.js
@weilandia - You can work around this by ensuring unique chunk names by including the hash in the "logical" part of the file name too:
chunkNames: 'chunks/[name][hash]-[hash].digested'
from propshaft.
After 3903815:
from propshaft.
@weilandia I can't seem to replicate the problem. I've created a demo app and configured it for esbuild, chunknames, and a lazy import (file named async.js
). It worked fine
Do you have a demo app showing the problem? If not, could you take a look at mine and indicated what I'm missing when trying to replicate?
from propshaft.
I can't recreate the issue with your app. If you add something like the below, you'll see the dynamic chunk file being added, but still no issue.
// a.js
import { d } from "./c.js"
console.log('a', d)
import("./b.js")
// b.js
import { c } from "./c.js"
console.log('b', c)
// c.js
export const c = 1
export const d = 2
Our app results in 76 of these chunk-...
files and about 75% of them result in 404s AFTER #3903815 but works fine before. I'll plan to dig into it more next week.
from propshaft.
Closing this because we decided not to do chunking with esbuild, though I do think there is a hard to reproduce issue when using propshaft with esbuild chunking on large apps (after 3903815).
from propshaft.
also running into this issue. @weilandia were you using anything like chunkNames: 'chunks/[name]-[hash].digested'
in esbuild options? If so, all the chunks resolve to the same chunks/chunk.js
path and asset.fresh?
fails in
propshaft/lib/propshaft/server.rb
Line 11 in 3903815
from propshaft.
I'm reviewing the esbuild docs and it seems there's no option to name the chunk anything other than chunk
. It seems the only solution might be reverting #100 at this point.
@rainerborene Any thoughts on this? Is there another way we can get propshaft to ensure the preloads still work without breaking esbuild chunks, which always have the same name?
from propshaft.
@brenogazzola, while not ideal - you can get esbuild to output unique chunks if you include the hash twice #111 (comment)
chunkNames: 'chunks/[name][hash]-[hash].digested'
I am testing propshaft (main branch & digested assets) & esbuild on a rails 7 upgrade and I have chunks loading, source maps loading (#117) - I have not yet got around to testing when esbuild updates a file and gets a new hash - whereby you have more than one "digested" file and propshaft should find the latest version
from propshaft.
Related Issues (20)
- Propshaft race condition with webpack creates 410 with dynamic chunk loading HOT 16
- Blocking Sprockets seeping in from gem dependencies HOT 2
- 404 response on assets in production HOT 1
- Flag Icons not showing HOT 1
- digested source maps HOT 4
- Large numbers of files in my app/assets directory causes development to become very slow HOT 5
- svg inline display issues HOT 3
- Asset digest is computed before compilation HOT 7
- Not able to detect changes in the assets HOT 1
- Raising an error when an asset is not found HOT 4
- config.asset_host as a proc breaks asset paths HOT 1
- quiet_assets initializer breaks when using a custom Rails logger HOT 2
- Using images inside node_modules HOT 3
- Newly added files that are already digested aren't available in development HOT 4
- `assets:clean` task is not cleaning predigested assets with `.digest` in the name HOT 7
- Allow digested files with the same name prefix
- Upgrade doc refers to 'packages.json' HOT 1
- Current version v0.7.0 contains the broken #118 asset_host handling HOT 1
- Revisit Gzip compression support? HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from propshaft.