Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions samples/weather-forecast/.babelrc

This file was deleted.

40 changes: 40 additions & 0 deletions samples/weather-forecast/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// babel.config.js (project-wide) instead of .babelrc (package-local).
// The key difference: babel.config.js applies to ALL files including node_modules
// that Jest is instructed to transform via transformIgnorePatterns.
// .babelrc is scoped to the package it lives in and does NOT apply to
// node_modules, so pure-ESM deps like @x0k/json-schema-merge (introduced by
// @rjsf/utils v6) would not have their `export` syntax compiled to CJS.
module.exports = {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
targets: '> 0.25%, not dead, not ie < 11',
},
],
'@babel/preset-react',
'@babel/preset-typescript',
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
],
env: {
test: {
presets: [
[
'@babel/preset-env',
{
targets: { node: 'current' },
modules: 'commonjs',
},
],
'@babel/preset-react',
'@babel/preset-typescript',
],
},
},
};
22 changes: 20 additions & 2 deletions samples/weather-forecast/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,25 @@ module.exports = {
moduleNameMapper: {
'icons/(.*)\.svg$': '<rootDir>/__mocks__/lazySvgMock.js',
'\\.svg$': '<rootDir>/__mocks__/fileMock.js',
'^axios$': 'axios/dist/node/axios.cjs'
'^axios$': 'axios/dist/node/axios.cjs',
// Load the ESM lib/ build of rjsf v6 packages instead of the esbuild CJS dist.
// The CJS dist uses __toESM(require(...), 1) (isNodeMode=1) which incorrectly
// wraps @mui/material CJS-with-__esModule modules as { default: wholeObject },
// causing "Element type is invalid: got object" in FieldTemplate.
// The lib/ ESM files are Babel-transformed, which handles __esModule interop
// correctly via _interopRequireDefault().default.
'^@rjsf/mui$': '<rootDir>/node_modules/@rjsf/mui/lib/index.js',
'^@rjsf/core$': '<rootDir>/node_modules/@rjsf/core/lib/index.js',
'^@rjsf/utils$': '<rootDir>/node_modules/@rjsf/utils/lib/index.js',
'^@rjsf/validator-ajv8$': '<rootDir>/node_modules/@rjsf/validator-ajv8/lib/index.js',
},
testEnvironment: 'jsdom',
testEnvironment: 'jsdom', testEnvironmentOptions: {
customExportConditions: ['require', 'default'],
}, transformIgnorePatterns: [
// Transform @rjsf (lib/ ESM files), @x0k/json-schema-merge (pure ESM),
// @mui/material (ESM subpath imports used by @rjsf/mui lib/), and lodash-es
// (pure ESM used throughout @rjsf/utils and @rjsf/core lib/ files).
'/node_modules/(?!(@x0k/json-schema-merge|@rjsf|@mui|lodash-es)/)',
],
};

30 changes: 16 additions & 14 deletions samples/weather-forecast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"author": "",
"license": "ISC",
"dependencies": {
"@staffbase/widget-sdk": "^3.17.0",
"@staffbase/widget-sdk": "^3.18.0",
"acorn": "^8.16.0",
"axios": "^1.15.0",
"axios": "^1.16.0",
"date-fns": "^2.30.0",
"dayjs": "1.11.20",
"react": "^18.3.1",
Expand All @@ -33,25 +33,25 @@
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.29.2",
"@babel/preset-env": "^7.29.3",
"@babel/preset-react": "^7.28.5",
"@babel/preset-typescript": "^7.28.5",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@mui/icons-material": "^6.5.0",
"@mui/material": "^6.5.0",
"@mui/system": "^7.3.7",
"@rjsf/core": "5.24.13",
"@rjsf/mui": "5.24.13",
"@rjsf/utils": "5.24.13",
"@rjsf/validator-ajv8": "5.24.13",
"@mui/system": "^9.0.0",
"@rjsf/core": "6.5.2",
"@rjsf/mui": "6.5.2",
"@rjsf/utils": "6.5.2",
"@rjsf/validator-ajv8": "6.5.2",
"@svgr/webpack": "8.1.0",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@types/jest": "^30.0.0",
"@types/json-schema": "^7.0.15",
"@types/node": "25.5.2",
"@types/node": "25.6.0",
"@types/react": "^18.3.24",
"@types/react-dom": "^18.3.7",
"@types/webpack": "5.28.5",
Expand All @@ -70,17 +70,19 @@
"jest-json-schema": "^6.1.0",
"js-base64": "3.7.8",
"minimal-polyfills": "2.2.3",
"prettier": "3.8.1",
"prettier": "3.8.3",
"ts-loader": "^9.5.7",
"ts-node": "10.9.2",
"typescript": "6.0.2",
"webpack": "^5.104.1",
"webpack-cli": "^6.0.1",
"typescript": "6.0.3",
"webpack": "^5.106.2",
"webpack-cli": "^7.0.2",
"webpack-dev-server": "^5.2.3",
"webpack-merge": "^6.0.1"
},
"resolutions": {
"webpack": "5.105.4",
"webpack": "5.106.2",
"fast-uri": "^3.1.2",
"@babel/plugin-transform-modules-systemjs": "^7.29.4",
"nth-check": ">=2.0.1",
"flatted": "3.4.2",
"minimatch": "3.1.4",
Expand Down
6 changes: 6 additions & 0 deletions samples/weather-forecast/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ const config: webpack.Configuration = {
},
module: {
rules: [
{
test: /\.m?js$/,
resolve: {
fullySpecified: false,
},
},
{
test: /\.tsx?$/,
use: ["babel-loader"],
Expand Down
Loading
Loading