-
Notifications
You must be signed in to change notification settings - Fork 698
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
version tag for modules for browser caching #55
Comments
The suggested way to do this with the existing capabilities would be to not use a querystring for the version, but place it as part of the path, so Then you can just use the regular paths config in the browser to set the path for 'foo' to the right place: requirejs.config({
paths: {
foo: 'v1/foo'
}
}); Or, if you like the v1 after: requirejs.config({
paths: {
//loads foo/v1.js
foo: 'foo/v1'
}
}); Using path args instead of querystring args also allows more caching by intermediate proxy servers. At least in the past, some might not cache has heavily for querystring args. Will that solve the problem? |
Good point. Thanks James. |
someone should build a tool to automate the process.. I was planning to read the PS: I won't have time to do it anytime soon. |
Consider this build config:
When you land on the index page, the common bundle script tag will be injected by RequireJS. We use the
src=foo.js?v=1
method to take advantage of browser caching, and to not get bitten by it, but we don't have control over the tags that RequireJS injects aside fromurlArgs
.Currently we set
urlArgs
to the build number of our app to ensure users get the latest JS. The problem is that we release every 2 weeks, and have plenty of hot fixes in-between, so our users will have to download every optimized module every time we release :(I'd propose a "version" key in a module's build config so that when RequireJS fetches a script, it'll append the version as urlArgs (or any other implementation that has the same effect)
This way a single module can change versions w/o requiring the entire front-end app to be downloaded again.
The text was updated successfully, but these errors were encountered: