From 2ef9ec91e631e0e76827f96ee60815a7d5ef0493 Mon Sep 17 00:00:00 2001 From: Josh Pollock Date: Tue, 11 Sep 2018 11:51:10 -0400 Subject: [PATCH 1/2] Add instructions for serving scripts over HTTPS --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 60f880b..f2491d6 100644 --- a/README.md +++ b/README.md @@ -71,3 +71,13 @@ If the development server is not running, the root `assets-manifest.json` is not ### Fatal Error: Cannot redeclare ReactWPScripts... 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. + +### 404 In WordPress When Loading Bundle On HTTPS Site +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. + +To fix this, you must enable HTTPS for the webpack server. + +0) Create a .env file in your plugin's root directory, if it does not exist. +1) In .env add `HTTPS=true` +2) Stop and restart the dev server. +3) See [this PR for more information](https://github.com/facebook/create-react-app/pull/552) From bf98c404e706fa8a3ac7cd83fcafcc27f5a189b8 Mon Sep 17 00:00:00 2001 From: Josh Pollock Date: Thu, 13 Sep 2018 13:41:52 -0400 Subject: [PATCH 2/2] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f2491d6..a5f11fc 100644 --- a/README.md +++ b/README.md @@ -80,4 +80,6 @@ To fix this, you must enable HTTPS for the webpack server. 0) Create a .env file in your plugin's root directory, if it does not exist. 1) In .env add `HTTPS=true` 2) Stop and restart the dev server. -3) See [this PR for more information](https://github.com/facebook/create-react-app/pull/552) +3) Load the new HTTPS localhost URL in the browser and dismiss any untrusted certificate warnings. + +See [this PR](https://github.com/facebook/create-react-app/pull/552) for more information.