2021-12-24 04:45:00 +08:00
|
|
|
const svgrPlugin = require("vite-plugin-svgr");
|
2022-01-08 08:20:55 +08:00
|
|
|
const path = require("path");
|
2021-12-24 04:45:00 +08:00
|
|
|
|
|
|
|
module.exports = {
|
2022-01-22 07:42:21 +08:00
|
|
|
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
2021-12-24 04:45:00 +08:00
|
|
|
framework: "@storybook/react",
|
|
|
|
core: {
|
|
|
|
builder: "storybook-builder-vite",
|
|
|
|
},
|
|
|
|
async viteFinal(config) {
|
2022-01-22 07:42:21 +08:00
|
|
|
config.plugins = config.plugins.filter(
|
|
|
|
(item) =>
|
|
|
|
!(
|
|
|
|
Array.isArray(item) &&
|
|
|
|
item.length > 0 &&
|
|
|
|
item[0].name === "vite-plugin-mdx"
|
|
|
|
)
|
|
|
|
);
|
2021-12-24 04:45:00 +08:00
|
|
|
config.plugins.push(svgrPlugin());
|
2022-01-08 08:20:55 +08:00
|
|
|
config.resolve = config.resolve || {};
|
|
|
|
config.resolve.alias = config.resolve.alias || {};
|
|
|
|
config.resolve.alias["$(res)"] = path.resolve(
|
|
|
|
__dirname,
|
|
|
|
"../node_modules/matrix-react-sdk/res"
|
|
|
|
);
|
|
|
|
config.resolve.dedupe = config.resolve.dedupe || [];
|
|
|
|
config.resolve.dedupe.push("react", "react-dom", "matrix-js-sdk");
|
2021-12-24 04:45:00 +08:00
|
|
|
return config;
|
|
|
|
},
|
|
|
|
};
|