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

@@ -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 }
}
]
})
]
});