Skip to content

Commit d29c918

Browse files
authored
Merge pull request #7008 from valadas/storybook-fix20260218
Upgraded Storybook to v10
2 parents d91d96e + 73d1d24 commit d29c918

4 files changed

Lines changed: 37 additions & 9 deletions

File tree

DNN Platform/Modules/ResourceManager/ResourceManager.Web/eslint.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ export default (tseslint.config(
4646
"@typescript-eslint/no-unsafe-return": "off"
4747
},
4848
}
49-
));
49+
));

Dnn.AdminExperience/ClientSide/Dnn.React.Common/.storybook/main.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
// This file has been automatically migrated to valid ESM format by Storybook.
12
import { join, dirname } from "path";
3+
import { createRequire } from "module";
4+
5+
const require = createRequire(import.meta.url);
26

37
/**
48
* This function is used to resolve the absolute path of a package.
@@ -17,13 +21,37 @@ const config = {
1721
addons: [
1822
getAbsolutePath("@storybook/addon-webpack5-compiler-swc"),
1923
getAbsolutePath("@storybook/addon-onboarding"),
20-
getAbsolutePath("@storybook/addon-docs")
24+
getAbsolutePath("@storybook/addon-docs"),
2125
],
2226
framework: {
2327
name: getAbsolutePath("@storybook/react-webpack5"),
2428
options: {}
2529
},
2630
webpackFinal: async (config) => {
31+
// Helper to check if a rule matches SVG files
32+
const matchesSvg = (rule) => rule.test instanceof RegExp && rule.test.test('.svg');
33+
34+
// Exclude SVG from the default asset/resource rule (top-level and inside oneOf blocks)
35+
config.module.rules.forEach((rule) => {
36+
if (matchesSvg(rule)) {
37+
rule.exclude = /\.svg$/i;
38+
}
39+
if (rule.oneOf) {
40+
rule.oneOf.forEach((subRule) => {
41+
if (matchesSvg(subRule)) {
42+
subRule.exclude = /\.svg$/i;
43+
}
44+
});
45+
}
46+
});
47+
48+
// Add @svgr/webpack to handle SVG imports as React components
49+
config.module.rules.push({
50+
test: /\.svg$/i,
51+
issuer: /\.[jt]sx?$/,
52+
use: ["@svgr/webpack"],
53+
});
54+
2755
config.module.rules.push({
2856
test: /\.less$/,
2957
use: [

Dnn.AdminExperience/ClientSide/Dnn.React.Common/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@
5656
"@babel/preset-react": "^7.27.1",
5757
"@babel/preset-typescript": "^7.28.5",
5858
"@eslint/compat": "^1.4.0",
59-
"@storybook/addon-docs": "9.1.13",
60-
"@storybook/addon-onboarding": "10.1.11",
61-
"@storybook/addon-webpack5-compiler-swc": "4.0.1",
62-
"@storybook/react-webpack5": "9.1.13",
59+
"@storybook/addon-docs": "10.2.10",
60+
"@storybook/addon-onboarding": "10.2.10",
61+
"@storybook/addon-webpack5-compiler-swc": "4.0.2",
62+
"@storybook/react-webpack5": "10.2.10",
6363
"@svgr/webpack": "^8.1.0",
6464
"babel-eslint": "^10.1.0",
6565
"babel-loader": "^10.0.0",
@@ -77,7 +77,7 @@
7777
"eslint-plugin-import": "^2.32.0",
7878
"eslint-plugin-jest": "^29.0.1",
7979
"eslint-plugin-react": "7.37.5",
80-
"eslint-plugin-storybook": "9.1.13",
80+
"eslint-plugin-storybook": "10.2.10",
8181
"eslint-webpack-plugin": "^5.0.2",
8282
"file-loader": "6.2.0",
8383
"less": "4.4.2",
@@ -90,7 +90,7 @@
9090
"react-dom": "^16.14.0",
9191
"react-hot-loader": "^4.13.1",
9292
"react-test-renderer": "^17.0.2",
93-
"storybook": "9.1.17",
93+
"storybook": "10.2.10",
9494
"style-loader": "^4.0.0",
9595
"typescript": "^5.9.3",
9696
"url-loader": "4.1.1",

Dnn.AdminExperience/ClientSide/Styles.Web/eslint.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ export default tseslint.config(
4242
"@typescript-eslint/no-deprecated": "warn",
4343
},
4444
},
45-
);
45+
);

0 commit comments

Comments
 (0)