Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Webpack configuration used for development only. It introduces HMR, which is a big time saver for my use case, and provides somewhat improved performance.
The front-end build is now run by the webpack dev server. Assets are no longer served statically by Fastify.
devServerConfiguration Keys and Descriptionport: 8080: Specifies the port number the development server runs on. Accessible athttp://localhost:8080. A different port is needed to avoid conflicts with the backend process. The web app is still accessible on port 3000 because the assets are still written to disk in the same location.historyApiFallback: trueEnsures requests that would normally return 404 fall back to
index.html, essential for SPAs with client-side routing.hot: true: Enables Hot Module Replacement (HMR), which updates modules in the browser without a full page refresh, improving the development experience.liveReload: false: Disables full page reload when files change, relying instead on HMR (hot: true) for updates.devMiddleware: { writeToDisk: true }: Configures the dev server to write the bundled files to disk. Useful for debugging or when processes require files on disk. As mentioned before, this allows Fastify to serve the front-end on port 3000 as well.proxy: Defines rules to forward specific requests to the appropriate backend or external services:context: ['/api/v1', '/account/', '/storage', '/ee/billing']: Redirects API requests to the local backend running onhttp://localhost:3000.context: ['/api']: Routes API requests tohttps://registry.npmjs.comand rewrites the path by removing/api. For example,/api/packagesbecomes/packages.context: ['/api/**/projects/**/resources/stream']: Proxies WebSocket requests tows://localhost:3000to support WebSocket connections with the backend.The proxy list is not complete. The
/setupendpoint does not work on port 8080 and must be accessed on port 3000. There may be other endpoints missing as well.I’m using this setup mainly for HMR during development, but it has also proved to be a better and more efficient alternative to the original setup.
In order to run you need to execute
npm run start-watchandnpm run webseparately and the web app will be available on port:8080(for HMR) while also preserving:3000Related Issue(s)
None – this is just a playground.
Checklist
flowforge.yml?FlowFuse/helmto update ConfigMap TemplateFlowFuse/CloudProjectto update values for Staging/ProductionLabels
area:migrationlabel