Skip to content

Commit afb1c0f

Browse files
authored
Merge pull request #38 from Shelob9/patch-2
Add instructions for serving scripts over HTTPS
2 parents 2945908 + bf98c40 commit afb1c0f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,15 @@ 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) Load the new HTTPS localhost URL in the browser and dismiss any untrusted certificate warnings.
84+
85+
See [this PR](https://github.com/facebook/create-react-app/pull/552) for more information.

0 commit comments

Comments
 (0)