Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions examples/async-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "Example usage of launchdarkly-react-client-sdk",
"main": "src/server/index.js",
"scripts": {
"start": "NODE_OPTIONS=--openssl-legacy-provider node src/server/index.js",
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack.config.client.js && NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack.config.server.js",
"start": "npm run build && node dist/serverBundle.js",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Client script port no longer served

High Severity

The updated start script only builds assets and runs dist/serverBundle.js on port 3000. The server HTML still requests bundle.js from http://localhost:3002, which webpack-serve used to provide. With that dev server removed, nothing listens on 3002, so the example page renders without client JavaScript.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 22a56e9. Configure here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in c2b3f2b. Updated both server.js HTML templates to use /dist/bundle.js (served by Express on the same port) and removed the stale localhost:3002 webpack publicPath from both webpack.config.client.js files.

"lint": "eslint ./src",
"serve": "webpack-serve webpack.config.server",
"postinstall": "cd ../../ && yarn link-dev"
},
"repository": {
Expand Down Expand Up @@ -53,11 +53,9 @@
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.11.1",
"universal-hot-reload": "^3.3.4",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.7",
"webpack-node-externals": "^1.7.2",
"webpack-serve": "^3.1.1"
"webpack-node-externals": "^1.7.2"
},
"resolutions": {
"acorn": "npm:acorn-with-stage3"
Expand Down
10 changes: 1 addition & 9 deletions examples/async-provider/src/server/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
const UniversalHotReload = require('universal-hot-reload').default;

// supply your own webpack configs
const serverConfig = require('../../webpack.config.server.js');
const clientConfig = require('../../webpack.config.client.js');

// the configs are optional, you can supply either one or both.
// if you omit say the server config, then your server won't hot reload.
UniversalHotReload({ serverConfig, clientConfig });
require('../../dist/serverBundle');
2 changes: 1 addition & 1 deletion examples/async-provider/src/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ app.use((req, res) => {
</head>
<body>
<div id="reactDiv"></div>
<script type="application/javascript" src="http://localhost:3002/dist/bundle.js"></script>
<script type="application/javascript" src="/dist/bundle.js"></script>
</body>
</html>`;

Expand Down
4 changes: 1 addition & 3 deletions examples/async-provider/webpack.config.client.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
const path = require('path');

const WebpackServeUrl = 'http://localhost:3002';

module.exports = {
mode: 'development',
devtool: 'source-map',
entry: ['@babel/polyfill', './src/client/index'],
output: {
path: path.resolve('dist'),
publicPath: `${WebpackServeUrl}/dist/`, // MUST BE FULL PATH!
publicPath: '/dist/',
filename: 'bundle.js',
},
module: {
Expand Down
6,466 changes: 2,649 additions & 3,817 deletions examples/async-provider/yarn.lock

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions examples/hoc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "Example usage of launchdarkly-react-client-sdk",
"main": "src/server/index.js",
"scripts": {
"start": "NODE_OPTIONS=--openssl-legacy-provider node src/server/index.js",
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack.config.client.js && NODE_OPTIONS=--openssl-legacy-provider webpack --config webpack.config.server.js",
"start": "npm run build && node dist/serverBundle.js",
"lint": "eslint ./src",
"serve": "webpack-serve webpack.config.server",
"postinstall": "cd ../../ && yarn link-dev"
},
"repository": {
Expand Down Expand Up @@ -52,11 +52,9 @@
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.11.1",
"universal-hot-reload": "^3.3.4",
"webpack": "^4.27.1",
"webpack-cli": "^3.1.2",
"webpack-node-externals": "^1.7.2",
"webpack-serve": "^2.0.3"
"webpack-node-externals": "^1.7.2"
},
"resolutions": {
"acorn": "npm:acorn-with-stage3"
Expand Down
10 changes: 1 addition & 9 deletions examples/hoc/src/server/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
const UniversalHotReload = require('universal-hot-reload').default;

// supply your own webpack configs
const serverConfig = require('../../webpack.config.server.js');
const clientConfig = require('../../webpack.config.client.js');

// the configs are optional, you can supply either one or both.
// if you omit say the server config, then your server won't hot reload.
UniversalHotReload({ serverConfig, clientConfig });
require('../../dist/serverBundle');
2 changes: 1 addition & 1 deletion examples/hoc/src/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ app.use((req, res) => {
<App />
</StaticRouter>,
)}</div>
<script type="application/javascript" src="http://localhost:3002/dist/bundle.js"></script>
<script type="application/javascript" src="/dist/bundle.js"></script>
</body>
</html>`;

Expand Down
4 changes: 1 addition & 3 deletions examples/hoc/webpack.config.client.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
const path = require('path');

const WebpackServeUrl = 'http://localhost:3002';

module.exports = {
mode: 'development',
devtool: 'source-map',
entry: ['@babel/polyfill', './src/client/index'],
output: {
path: path.resolve('dist'),
publicPath: `${WebpackServeUrl}/dist/`, // MUST BE FULL PATH!
publicPath: '/dist/',
filename: 'bundle.js',
},
module: {
Expand Down
Loading
Loading