Skip to content

Commit 2ef9ec9

Browse files
authored
Add instructions for serving scripts over HTTPS
1 parent 2945908 commit 2ef9ec9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,13 @@ If the development server is not running, the root `assets-manifest.json` is not
7171
### Fatal Error: Cannot redeclare ReactWPScripts...
7272

7373
If you get an error that you cannot reduplicate a method in the `ReactWPScripts` namespace, the cause is likely that two copies of `loader.php` are present in separate plugins or themes. Switch the copy in the plugin or theme under development to use a different namespace to avoid collision.
74+
75+
### 404 In WordPress When Loading Bundle On HTTPS Site
76+
By default create-react-app's webpack dev server does NOT use HTTPS. If your WordPress site uses HTTPS, you are likely to get a 404 error like `https://localhost:3000/static/js/bundle.js` in WordPress, even though the webpack dev server, when accessed directly works fine.
77+
78+
To fix this, you must enable HTTPS for the webpack server.
79+
80+
0) Create a .env file in your plugin's root directory, if it does not exist.
81+
1) In .env add `HTTPS=true`
82+
2) Stop and restart the dev server.
83+
3) See [this PR for more information](https://github.com/facebook/create-react-app/pull/552)

0 commit comments

Comments
 (0)