-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Static keys for vendor bundle in asset-manifest.json #5225
Comments
Chunks can change at any time, adding or removing them. I'm not sure having static keys would help too much. This file should still be easily iterable programmatically. |
Considering the use case mentioned in #5172: It looks like loading an application now requires the runtime ( How can a CRA-agnostic backend properly serve the application, if the vendor chunk is not statically keyed? Sorry, if this sounds like a dumb question. |
I ended up parsing asset-manifest.json like this to compile a list of <script> tags to include: // node
const assets = readFileAsync('build/asset-manifest.json').then(buffer => JSON.parse(buffer.toString()));
const scriptsTmpl = paths => paths.map(path => `<script src="${path}"></script>`).join('\n');
const scriptPaths = [
assets['runtime~main.js'],
...Object.keys(assets)
.filter(key => key.endsWith('.chunk.js'))
.map(key => assets[key]),
assets['main.js'],
];
const scriptsHTML = scriptsTmpl(scriptPaths); |
But wouldn’t that defeat the purpose of chunks, as you are loading ALL chunks? The problem is that the |
Hello, have same issue. Can be used next workaround within https://www.npmjs.com/package/@craco/craco
|
Currently the asset-manifest.json in my build folder looks like this:
I want to be able to use this asset-manifest.json to reference and and include my own script tags. However, the vendor bundle has dynamic keys:
Is it possible to make these references something like
static/css/1.chunk.css
instead?Using react-scripts@2.0.3
The text was updated successfully, but these errors were encountered: