mirror of
https://github.com/stan-smith/FossFLOW.git
synced 2026-04-24 09:03:36 -04:00
This resolves console errors when items are deleted or during undo/redo operations. Changes: - Added getItemById utility function that returns null instead of throwing - Updated all item hooks to return null when items don't exist - Added null checks in components that use these hooks - Components now gracefully handle missing items by returning null - Fixed TypeScript export syntax in standaloneExports.ts - Added MUI dependencies as externals in webpack config This fixes the "Item with id not found" errors that were occurring when: - Using undo/redo functionality - Items were deleted but components were still rendering - React was unmounting components that referenced deleted items
63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
const path = require('path');
|
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
const webpack = require('webpack');
|
|
|
|
module.exports = {
|
|
mode: 'production',
|
|
target: 'web',
|
|
entry: {
|
|
'index': './src/Isoflow.tsx',
|
|
'/standaloneExports': './src/standaloneExports.ts',
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, '../dist'),
|
|
filename: '[name].js',
|
|
libraryTarget: 'commonjs2'
|
|
},
|
|
externals: {
|
|
react: {
|
|
commonjs: 'react',
|
|
commonjs2: 'react',
|
|
amd: 'React',
|
|
root: 'React'
|
|
},
|
|
'react-dom': {
|
|
commonjs: 'react-dom',
|
|
commonjs2: 'react-dom',
|
|
amd: 'ReactDOM',
|
|
root: 'ReactDOM'
|
|
},
|
|
'@mui/material': '@mui/material',
|
|
'@mui/icons-material': '@mui/icons-material',
|
|
'@emotion/react': '@emotion/react',
|
|
'@emotion/styled': '@emotion/styled'
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(ts|tsx)$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/
|
|
},
|
|
{
|
|
test: /\.css$/i,
|
|
use: ['style-loader', 'css-loader']
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
type: 'asset/inline'
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
PACKAGE_VERSION: JSON.stringify(require("../package.json").version),
|
|
REPOSITORY_URL: JSON.stringify(require("../package.json").repository.url),
|
|
})
|
|
],
|
|
resolve: {
|
|
extensions: ['.tsx', '.ts', '.js'],
|
|
plugins: [new TsconfigPathsPlugin()]
|
|
}
|
|
};
|