Skip to content

Feat/uepr 156 webpack v5 upgrade#3502

Open
KManolov3 wants to merge 3 commits intodevelopfrom
feat/uepr-156-webpack-v5-upgrade
Open

Feat/uepr 156 webpack v5 upgrade#3502
KManolov3 wants to merge 3 commits intodevelopfrom
feat/uepr-156-webpack-v5-upgrade

Conversation

@KManolov3
Copy link
Copy Markdown
Contributor

@KManolov3 KManolov3 commented Mar 16, 2026

Resolves

https://scratchfoundation.atlassian.net/browse/UEPR-156
https://scratchfoundation.atlassian.net/browse/UEPR-154
https://scratchfoundation.atlassian.net/browse/UEPR-159

Proposed Changes

  • Upgrade webpack to v5 as well as other packages where necesasry to support the change
  • Introduce scratch-webpack-configuration
  • Update the webpack config to use scratch-webpack-configuration
  • Upgrade node to v24 to be consistent with editor
  • Upgrade canvas to v3, which is earliest version suppporting node v24.

Reason for Changes

Prepare scratch-paint for introduction to the scratch-editor monorepo

Test Coverage

All existing tests are passing

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

Upgrades the build/tooling stack to prepare scratch-paint for inclusion in the scratch-editor monorepo, centered around a Webpack 5 migration and Node 24 alignment.

Changes:

  • Upgrade to Webpack 5 + related loader/plugin updates and adopt scratch-webpack-configuration.
  • Update package entrypoints (main/exports) and dev-server invocation for the new build.
  • Bump Node runtime to v24 and upgrade canvas to a compatible major version.

Reviewed changes

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

File Description
webpack.config.js Replaces bespoke webpack config with scratch-webpack-configuration builder and updates playground/library builds.
package.json Updates build scripts, dependencies, and introduces exports + new main path.
.nvmrc Pins Node to 24.14.0.
.babelrc Removes explicit object-rest-spread plugin, relying on preset-env.

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

Comment on lines 22 to 28
output: {
path: path.resolve(__dirname, 'playground'),
filename: '[name].js'
},
plugins: base.plugins.concat([
new HtmlWebpackPlugin({
template: 'src/playground/index.ejs',
title: 'Scratch 3.0 Paint Editor Playground'
})
])
}),
// For use as a library
defaultsDeep({}, base, {
externals: {
'minilog': 'minilog',
'prop-types': 'prop-types',
'react': 'react',
'react-dom': 'react-dom',
'react-intl': 'react-intl',
'react-intl-redux': 'react-intl-redux',
'react-popover': 'react-popover',
'react-redux': 'react-redux',
'react-responsive': 'react-responsive',
'react-style-proptype': 'react-style-proptype',
'react-tooltip': 'react-tooltip',
'redux': 'redux'
library: {
name: 'scratch-paint',
type: 'umd2'
}
},
package.json Outdated
Comment on lines +5 to +11
"main": "./dist/web/scratch-paint.js",
"browser": "./src/index.js",
"exports": {
"webpack": "./src/index.js",
"browser": "./dist/web/scratch-paint.js",
"node": "./dist/web/scratch-paint.js",
"default": "./src/index.js"
Copy link
Copy Markdown
Contributor Author

@KManolov3 KManolov3 Mar 16, 2026

Choose a reason for hiding this comment

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

I think it might be more correct to update the exports browser to ./src/index/js. (for now), since this will preserve current behaviour

package.json Outdated
"webpack": "./src/index.js",
"browser": "./dist/web/scratch-paint.js",
"node": "./dist/web/scratch-paint.js",
"default": "./src/index.js"
Copy link
Copy Markdown
Contributor

@cwillisf cwillisf left a comment

Choose a reason for hiding this comment

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

Amazing! Thank you!

Copy link
Copy Markdown

@adzhindzhi adzhindzhi left a comment

Choose a reason for hiding this comment

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

Looks great! 🙌

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.

5 participants