2021-12-23 12:45:00 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const svgrPlugin = require("vite-plugin-svgr");
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-07 16:20:55 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const path = require("path");
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-23 12:45:00 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								module.exports = {
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-21 15:42:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-23 12:45:00 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  framework: "@storybook/react",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  core: {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    builder: "storybook-builder-vite",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  },
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  async viteFinal(config) {
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-21 15:42:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    config.plugins = config.plugins.filter(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      (item) =>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        !(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          Array.isArray(item) &&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          item.length > 0 &&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          item[0].name === "vite-plugin-mdx"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    );
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-23 12:45:00 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    config.plugins.push(svgrPlugin());
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-07 16: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-23 12:45:00 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return config;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  },
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 |