Skip to content

chore: migrate build system from webpack 4 to Vite 6#158

Draft
Copilot wants to merge 1 commit intomasterfrom
copilot/update-build-process-to-vite
Draft

chore: migrate build system from webpack 4 to Vite 6#158
Copilot wants to merge 1 commit intomasterfrom
copilot/update-build-process-to-vite

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Replaces the webpack 4 build pipeline (requiring NODE_OPTIONS="--openssl-legacy-provider" on Node 17+) with Vite 6.4.2, which works natively with modern Node.js and produces faster builds.

Key changes

  • vite.config.mjs — new Vite config in UMD library mode:

    • Custom resolve-src plugin replicates webpack's resolve.modules: ['./src'], preserving bare imports like import { ... } from "storage.js"
    • Externals (jqueryjQuery, knockoutko, filepondFilePond) carried over unchanged
    • BUILD_MIN=true env var toggles minification and selects output filename (blockpy.js vs blockpy.min.js)
    • CSS extracted to dist/blockpy.css; inline source maps retained
  • package.json:

    • build: vite build --config vite.config.mjs && cross-env BUILD_MIN=true vite build --config vite.config.mjs
    • dev: vite build --watch --config vite.config.mjs
    • Removed: webpack, webpack-cli, babel-loader, eslint-loader, css-loader, mini-css-extract-plugin, @babel/core, @babel/preset-env, yargs, path
    • Added: vite@6.4.2, cross-env@10.1.0 (cross-platform env var syntax)
  • Removed: webpack.config.js, .babelrc

Output (unchanged structure)

File Description
dist/blockpy.js Unminified UMD bundle
dist/blockpy.min.js Minified UMD bundle
dist/blockpy.css Extracted styles

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.

2 participants