Skip to content
This repository was archived by the owner on Jun 11, 2022. It is now read-only.

Commit b9040a5

Browse files
authored
Support for custom bundle location via JS_RUNTIME_TARGET_BUNDLE (#117)
* Support for custom bundle location via `JS_RUNTIME_TARGET_BUNDLE` * 📚 about custom bundle location * 📚 how to unset custom bundle path * Upgrade to inner buildpack with improved custom bundle UX
1 parent a27f436 commit b9040a5

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

.buildpacks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
https://github.com/heroku/heroku-buildpack-nodejs.git
2-
https://github.com/mars/create-react-app-inner-buildpack.git#v4.0.0
2+
https://github.com/mars/create-react-app-inner-buildpack.git#v5.1.0
33
https://github.com/heroku/heroku-buildpack-static.git

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ The default `static.json`, if it does not exist in the repo, is:
186186
{ "root": "build/" }
187187
```
188188

189+
### Changing the root
190+
191+
If a different web server `"root"` is specified, such as with a highly customized, ejected create-react-app project, then the new bundle location may need to be [set to enable runtime environment variables](#user-content-custom-bundle-location).
192+
189193
### Routing clean URLs
190194

191195
[React Router](https://github.com/ReactTraining/react-router) (not included) may easily use hash-based URLs like `https://example.com/index.html#/users/me/edit`. This is nice & easy when getting started with local development, but for a public app you probably want real URLs like `https://example.com/users/me/edit`.
@@ -373,6 +377,22 @@ class App extends Component {
373377

374378
⚠️ *Avoid setting backslash escape sequences, such as `\n`, into Runtime config vars. Use literal UTF-8 values only; they will be automatically escaped.*
375379

380+
#### Custom bundle location
381+
382+
If the javascript bundle location is customized, such as with an ejected created-react-app project, then the runtime may not be able to locate the bundle to inject runtime variables.
383+
384+
To solve this so the runtime can locate the bundle, set the custom bundle path:
385+
386+
```bash
387+
heroku config:set JS_RUNTIME_TARGET_BUNDLE=/app/my/custom/path/js/main.*.js
388+
```
389+
390+
To unset this config and use the default path for **create-react-app**'s bundle, `/app/build/static/js/main.*.js`:
391+
392+
```bash
393+
heroku config:unset JS_RUNTIME_TARGET_BUNDLE
394+
```
395+
376396
### Add-on config vars
377397

378398
🤐 *Be careful not to export secrets. These values may be accessed by anyone who can see the React app.*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy