Skip to content

feat: configure webpack-dev-server for independent frontend development #1999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

hydrosquall
Copy link

@hydrosquall hydrosquall commented Feb 11, 2022

Motivation

Changes

  • Added webpack-dev-server dependency + upgraded webpack-cli
  • Created a pair of lodash.template templates index.html and preview.html for the two primary routes needed for the app's functionality. Populates with the environment variables through the same dotenv configuration path as the server. Omits some of the variables that seemed unrelated to frontend development.
  • Updated documentation for how to use the new dev server
  • Manually verified screenshot: https://a.cl.ly/L1uWEq1l

Testing

Try running this locally:

npm run start:frontend-server

Checklist

  • has no linting errors (npm run lint)
  • is from a uniquely-named feature branch and has been rebased on top of the latest develop branch. (If I was asked to make more changes, I have made sure to rebase onto develop then too)
  • is descriptively named and links to an issue number, i.e. Fixes #123

@release-com
Copy link

release-com bot commented Feb 11, 2022

Release Environments

This pull request environment is provided by Release, learn more!
To see the status of the environment click on Environment Status below.

🔧Environment Status : https://app.releasehub.com/public/Processing%20Foundation/env-95c3decd04

@@ -0,0 +1 @@
12.16.1
Copy link
Author

Choose a reason for hiding this comment

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

Based on #1308

screen,
within
} from './test-utils';
import { reduxRender, act, waitFor, screen, within } from './test-utils';
Copy link
Author

Choose a reason for hiding this comment

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

lint requested the removal of fireEvent

@@ -131,7 +132,8 @@
"storybook-addon-theme-playground": "^1.2.0",
"style-loader": "^2.0.0",
"terser-webpack-plugin": "^4.2.3",
"webpack-cli": "^4.4.0",
"webpack-cli": "^4.9.2",
Copy link
Author

Choose a reason for hiding this comment

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

Bumped this version because of symfony/webpack-encore#1069 (comment) .

window.process.env = {};
}

window.process.env.API_URL = '<%= htmlWebpackPlugin.options.API_URL %>';
Copy link
Author

Choose a reason for hiding this comment

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

The syntax for variable interpolation comes from https://lodash.com/docs/4.17.15#template . Using other templating languages (ejs, handelbars, etc) would have required installing another loader.

@hydrosquall
Copy link
Author

Release Environments

This pull request environment is provided by Release, learn more! To see the status of the environment click on Environment Status below.

🔧Environment Status : https://app.releasehub.com/public/Processing%20Foundation/env-95c3decd04

@catarak which port does the preview app usually run on? It looks like 8080 and 5000 don't seem to be it. (The change I made shouldn't be picked up since I didn't change the existing build step, I just wanted to make sure that changing webpack-cli's version didn't break anything surprising).

@raclim
Copy link
Collaborator

raclim commented Apr 19, 2023

Thank you so much for all of your efforts and for taking the time to contribute to this issue—I'm so sorry we couldn't get to your work in time! Since some time has passed I'm going to close this for now, but please feel free to reopen this or work on this again, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dev-task] Separate Webpack Dev server from API server
2 participants