|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (c) 2026 Obeo. |
| 3 | + * This program and the accompanying materials |
| 4 | + * are made available under the terms of the Eclipse Public License v2.0 |
| 5 | + * which accompanies this distribution, and is available at |
| 6 | + * https://www.eclipse.org/legal/epl-2.0/ |
| 7 | + * |
| 8 | + * SPDX-License-Identifier: EPL-2.0 |
| 9 | + * |
| 10 | + * Contributors: |
| 11 | + * Obeo - initial API and implementation |
| 12 | + *******************************************************************************/ |
| 13 | +import { dirname, resolve } from "path"; |
| 14 | +import { fileURLToPath } from "url"; |
| 15 | +import { mergeConfig } from "vite"; |
| 16 | + |
| 17 | +const __dirname = dirname(fileURLToPath(import.meta.url)); |
| 18 | + |
| 19 | +const config = { |
| 20 | + stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], |
| 21 | + addons: [ |
| 22 | + "@chromatic-com/storybook", |
| 23 | + "@storybook/addon-vitest", |
| 24 | + "@storybook/addon-a11y", |
| 25 | + "@storybook/addon-docs", |
| 26 | + ], |
| 27 | + framework: { |
| 28 | + name: "@storybook/react-vite", |
| 29 | + options: {}, |
| 30 | + }, |
| 31 | + typescript: { |
| 32 | + reactDocgen: "react-docgen-native", |
| 33 | + }, |
| 34 | + async viteFinal(config) { |
| 35 | + return mergeConfig(config, { |
| 36 | + resolve: { |
| 37 | + alias: { |
| 38 | + react: resolve(__dirname, "../../../node_modules/react"), |
| 39 | + "react-dom": resolve(__dirname, "../../../node_modules/react-dom"), |
| 40 | + "@emotion/react": resolve( |
| 41 | + __dirname, |
| 42 | + "../../../node_modules/@emotion/react", |
| 43 | + ), |
| 44 | + "@emotion/styled": resolve( |
| 45 | + __dirname, |
| 46 | + "../../../node_modules/@emotion/styled", |
| 47 | + ), |
| 48 | + "@mui/material": resolve( |
| 49 | + __dirname, |
| 50 | + "../../../node_modules/@mui/material", |
| 51 | + ), |
| 52 | + }, |
| 53 | + }, |
| 54 | + server: { |
| 55 | + fs: { |
| 56 | + // On autorise Vite à lire toute l'arborescence du projet |
| 57 | + allow: [resolve(__dirname, "../../../")], |
| 58 | + }, |
| 59 | + }, |
| 60 | + }); |
| 61 | + }, |
| 62 | +}; |
| 63 | + |
| 64 | +export default config; |
0 commit comments