Skip to content

fix: add clean script and update start scripts for Webpack migration#401

Closed
DennisOSRM wants to merge 7 commits intogh-pagesfrom
fixes_gh_pages
Closed

fix: add clean script and update start scripts for Webpack migration#401
DennisOSRM wants to merge 7 commits intogh-pagesfrom
fixes_gh_pages

Conversation

@DennisOSRM
Copy link
Copy Markdown
Contributor

Summary

Addresses reviewer feedback on PR #399 by:

  1. Adding clean script - Removes stale bundle.raw.js artifact before builds to prevent confusion with active build outputs
  2. Updating build sequence - Now runs: clean → replace → compile → copy CSS
  3. Fixing start scripts - Replaced deprecated budo/bistre tools with webpack-dev-server for development
  4. Configuring dev server - Properly serves static files from project root so index.html is accessible

Changes

  • package.json: Added clean script, updated build/start scripts, added webpack-dev-server
  • webpack.config.js: Added devServer configuration

Testing

  • npm run build successfully cleans and compiles
  • npm run start serves the webpage at http://localhost:9000
  • ✅ No new vulnerabilities introduced

Related to

PR #399: Replace Browserify with Webpack

rahulkumaar03 and others added 2 commits March 31, 2026 22:15
- Add 'clean' script to remove stale bundle.raw.js artifact
- Update 'build' script to run clean before replace and compile
- Replace deprecated budo/bistre with webpack-dev-server for development
- Add webpack-dev-server to devDependencies
- Simplify start-prod to just run build
- Configure webpack-dev-server to serve static files from project root

Prevents stale Browserify output from being confused with active build artifacts.
Addresses reviewer feedback on PR #399

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 10, 2026 09:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates build/start tooling as part of the Browserify → Webpack migration follow-up, adding a cleanup step and switching development serving to webpack-dev-server.

Changes:

  • Added a clean script and reordered the build pipeline (clean → replace → webpack compile → copy CSS).
  • Replaced budo/bistre-based dev start with webpack serve.
  • Added devServer configuration to serve static files from the project root.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
package.json Adds clean, updates build/start scripts, and swaps dev tooling to webpack/webpack-dev-server.
webpack.config.js Introduces webpack config including devServer static serving and module fallbacks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"compile": "webpack --config webpack.config.js",
"build": "npm run clean && npm run replace && npm run compile && cp node_modules/leaflet/dist/leaflet.css css/leaflet.css",
"start": "npm run build && webpack serve --config webpack.config.js --mode development",
"start-prod": "npm run build",
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

start-prod no longer starts an HTTP server (it only runs the build and exits). This breaks the existing Docker runtime (docker/Dockerfile runs npm run start-prod and exposes port 9966), and will cause containers to terminate immediately. Please change start-prod to start a server (e.g., webpack serve or a lightweight static server) and ensure it binds to the expected port/host (9966 / 0.0.0.0), or update the Docker entrypoint accordingly.

Suggested change
"start-prod": "npm run build",
"start-prod": "npm run build && webpack serve --config webpack.config.js --mode production --host 0.0.0.0 --port 9966",

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +13
"build": "npm run clean && npm run replace && npm run compile && cp node_modules/leaflet/dist/leaflet.css css/leaflet.css",
"start": "npm run build && webpack serve --config webpack.config.js --mode development",
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

npm run start runs npm run build and then starts webpack serve, which recompiles the bundle again in-memory. This duplicates work and slows down local startup. Consider splitting dev vs prod steps (e.g., run only clean/replace/CSS copy before webpack serve, or move CSS copying into the webpack pipeline so webpack serve is the single compilation step).

Suggested change
"build": "npm run clean && npm run replace && npm run compile && cp node_modules/leaflet/dist/leaflet.css css/leaflet.css",
"start": "npm run build && webpack serve --config webpack.config.js --mode development",
"start-prep": "npm run clean && npm run replace && cp node_modules/leaflet/dist/leaflet.css css/leaflet.css",
"build": "npm run clean && npm run replace && npm run compile && cp node_modules/leaflet/dist/leaflet.css css/leaflet.css",
"start": "npm run start-prep && webpack serve --config webpack.config.js --mode development",

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +12
"clean": "rm -f bundle.raw.js",
"compile": "webpack --config webpack.config.js",
"build": "npm run clean && npm run replace && npm run compile && cp node_modules/leaflet/dist/leaflet.css css/leaflet.css",
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The new clean script uses rm -f, which is not available in a default Windows environment. The README currently documents a Windows dev workflow, so this introduces an additional cross-platform regression (and npm run start now depends on clean). Prefer a cross-platform deletion (e.g., a small Node script using fs.rmSync(...,{force:true}) or a tool like rimraf). Also, if bundle.raw.js is still tracked in git, consider removing it from the repo and adding it to .gitignore so it doesn’t reappear as a stale artifact.

Copilot uses AI. Check for mistakes.
DennisOSRM and others added 3 commits April 10, 2026 12:35
- Replace .eslintrc (deprecated) with eslint.config.js
- Move ignore patterns from .eslintignore to ignores property
- Update languageOptions with proper globals for Node and browser
- Add type: module to package.json to eliminate Node warnings

This resolves ESLint v10.2.0 compatibility issues.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The directive on line 2 was unused since the actual comparisons
with null already have their own disable comments on lines 6 and 14.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
DennisOSRM and others added 2 commits April 10, 2026 13:14
Adding type: module breaks CommonJS scripts used in the build process.
ESLint can handle eslint.config.js as ESM without the type field.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Using .mjs extension explicitly marks the file as an ES module,
eliminating the MODULE_TYPELESS_PACKAGE_JSON warning without
requiring type: module in package.json (which breaks build scripts).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@DennisOSRM DennisOSRM closed this Apr 10, 2026
@DennisOSRM DennisOSRM deleted the fixes_gh_pages branch April 10, 2026 11:30
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.

3 participants