Updated project to React 19

This commit is contained in:
Richard Osborne
2025-12-07 17:32:53 +01:00
parent 2153baf627
commit 8fed72d025
70 changed files with 4534 additions and 5309 deletions

View File

@@ -30,20 +30,20 @@
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/preset-env": "^7.28.3",
"@babel/preset-react": "^7.27.1",
"@types/jest": "^27.5.2",
"@types/jest": "^29.5.14",
"babel-loader": "^8.4.1",
"clean-webpack-plugin": "^1.0.1",
"copy-webpack-plugin": "^4.6.0",
"css-loader": "^5.0.0",
"jest": "^28.1.0",
"style-loader": "^2.0.0",
"ts-jest": "^28.0.3",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.11.0",
"jest": "^29.7.0",
"style-loader": "^3.3.4",
"ts-jest": "^29.4.1",
"ts-loader": "^9.5.4",
"typescript": "^5.1.3",
"typescript": "^4.9.5",
"webpack": "^5.101.3",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^3.11.2",
"webpack-dev-server": "^4.15.2",
"webpack-merge": "^5.10.0"
}
}

View File

@@ -3,38 +3,35 @@ const { merge } = require('webpack-merge');
const { outPath } = require('./constants.js');
const common = require('./webpack.common.js');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const noodlEditorExternalDeployPath = path.join(outPath, 'deploy');
function stripStartDirectories(targetPath, numDirs) {
const p = targetPath.split('/');
p.splice(0, numDirs);
return p.join(path.sep);
}
module.exports = merge(common, {
entry: {
deploy: './index.deploy.js'
},
output: {
filename: 'noodl.[name].js',
path: noodlEditorExternalDeployPath
path: noodlEditorExternalDeployPath,
clean: true
},
plugins: [
new CleanWebpackPlugin(noodlEditorExternalDeployPath, {
allowExternal: true
}),
new CopyWebpackPlugin([
{
from: 'static/shared/**/*',
transformPath: (targetPath) => stripStartDirectories(targetPath, 2)
},
{
from: 'static/deploy/**/*',
transformPath: (targetPath) => stripStartDirectories(targetPath, 2)
}
])
new CopyWebpackPlugin({
patterns: [
{
from: 'static/shared',
to: '.',
noErrorOnMissing: true,
info: { minimized: true }
},
{
from: 'static/deploy',
to: '.',
noErrorOnMissing: true,
info: { minimized: true }
}
]
})
]
});

View File

@@ -1,39 +1,30 @@
const path = require('path');
const { outPath } = require('./constants.js');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const noodlEditorExternalDeployPath = path.join(outPath, 'ssr');
function stripStartDirectories(targetPath, numDirs) {
const p = targetPath.split('/');
p.splice(0, numDirs);
return p.join(path.sep);
}
module.exports = {
entry: {
deploy: './index.ssr.js'
},
output: {
filename: 'noodl.[name].js',
path: noodlEditorExternalDeployPath
path: noodlEditorExternalDeployPath,
clean: true
},
plugins: [
new CleanWebpackPlugin(noodlEditorExternalDeployPath, {
allowExternal: true
}),
new CopyWebpackPlugin([
// {
// from: 'static/shared/**/*',
// transformPath: (targetPath) => stripStartDirectories(targetPath, 2)
// },
{
from: 'static/ssr/**/*',
transformPath: (targetPath) => stripStartDirectories(targetPath, 2)
}
])
new CopyWebpackPlugin({
patterns: [
{
from: 'static/ssr',
to: '.',
noErrorOnMissing: true,
info: { minimized: true }
}
]
})
],
externals: {
react: 'React',

View File

@@ -5,38 +5,35 @@ const { merge } = require('webpack-merge');
const { outPath } = require('./constants.js');
const common = require('./webpack.common.js');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const noodlEditorExternalViewerPath = path.join(outPath, 'viewer');
function stripStartDirectories(targetPath, numDirs) {
const p = targetPath.split('/');
p.splice(0, numDirs);
return p.join(path.sep);
}
module.exports = merge(common, {
entry: {
viewer: './index.viewer.js'
},
output: {
filename: 'noodl.[name].js',
path: noodlEditorExternalViewerPath
path: noodlEditorExternalViewerPath,
clean: true
},
plugins: [
new CleanWebpackPlugin(noodlEditorExternalViewerPath, {
allowExternal: true
}),
new CopyWebpackPlugin([
{
from: 'static/shared/**/*',
transformPath: (targetPath) => stripStartDirectories(targetPath, 2)
},
{
from: 'static/viewer/**/*',
transformPath: (targetPath) => stripStartDirectories(targetPath, 2)
}
])
new CopyWebpackPlugin({
patterns: [
{
from: 'static/shared',
to: '.',
noErrorOnMissing: true,
info: { minimized: true }
},
{
from: 'static/viewer',
to: '.',
noErrorOnMissing: true,
info: { minimized: true }
}
]
})
]
});