|
1 | 1 | /// <reference types='vitest' /> |
2 | | -import { defineConfig } from 'vite'; |
3 | | -import react from '@vitejs/plugin-react-swc'; |
4 | | -import dts from 'vite-plugin-dts'; |
5 | | -import * as path from 'path'; |
6 | | -import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; |
7 | | -import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; |
| 2 | +import { defineConfig } from "vite"; |
| 3 | +import react from "@vitejs/plugin-react-swc"; |
| 4 | +import dts from "vite-plugin-dts"; |
| 5 | +import * as path from "path"; |
| 6 | +import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin"; |
| 7 | +import { nxCopyAssetsPlugin } from "@nx/vite/plugins/nx-copy-assets.plugin"; |
8 | 8 |
|
9 | 9 | export default defineConfig({ |
10 | | - root: __dirname, |
11 | | - cacheDir: '../../node_modules/.vite/packages/ui', |
12 | | - plugins: [ |
13 | | - react(), |
14 | | - nxViteTsPaths(), |
15 | | - nxCopyAssetsPlugin(['*.md']), |
16 | | - dts({ |
17 | | - entryRoot: 'src', |
18 | | - tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'), |
19 | | - }), |
20 | | - ], |
21 | | - // Uncomment this if you are using workers. |
22 | | - // worker: { |
23 | | - // plugins: [ nxViteTsPaths() ], |
24 | | - // }, |
25 | | - // Configuration for building your library. |
26 | | - // See: https://vitejs.dev/guide/build.html#library-mode |
27 | | - build: { |
28 | | - outDir: '../../dist/packages/ui', |
29 | | - emptyOutDir: true, |
30 | | - reportCompressedSize: true, |
31 | | - commonjsOptions: { |
32 | | - transformMixedEsModules: true, |
33 | | - }, |
34 | | - lib: { |
35 | | - // Could also be a dictionary or array of multiple entry points. |
36 | | - entry: 'src/index.ts', |
37 | | - name: 'ui', |
38 | | - fileName: 'index', |
39 | | - // Change this to the formats you want to support. |
40 | | - // Don't forget to update your package.json as well. |
41 | | - formats: ['es', 'cjs'], |
42 | | - }, |
43 | | - rollupOptions: { |
44 | | - // External packages that should not be bundled into your library. |
45 | | - external: ['react', 'react-dom', 'react/jsx-runtime'], |
46 | | - }, |
47 | | - }, |
48 | | - test: { |
49 | | - watch: false, |
50 | | - globals: true, |
51 | | - environment: 'jsdom', |
52 | | - include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], |
53 | | - reporters: ['default'], |
54 | | - coverage: { |
55 | | - reportsDirectory: '../../coverage/packages/ui', |
56 | | - provider: 'v8', |
57 | | - }, |
58 | | - }, |
| 10 | + root: __dirname, |
| 11 | + cacheDir: "../../node_modules/.vite/packages/ui", |
| 12 | + plugins: [ |
| 13 | + react(), |
| 14 | + nxViteTsPaths(), |
| 15 | + nxCopyAssetsPlugin(["*.md"]), |
| 16 | + dts({ |
| 17 | + entryRoot: "src", |
| 18 | + tsconfigPath: path.join(__dirname, "tsconfig.lib.json"), |
| 19 | + }), |
| 20 | + ], |
| 21 | + resolve: { |
| 22 | + alias: { |
| 23 | + "@": path.resolve(__dirname, "./src"), |
| 24 | + }, |
| 25 | + }, |
| 26 | + // Uncomment this if you are using workers. |
| 27 | + // worker: { |
| 28 | + // plugins: [ nxViteTsPaths() ], |
| 29 | + // }, |
| 30 | + // Configuration for building your library. |
| 31 | + // See: https://vitejs.dev/guide/build.html#library-mode |
| 32 | + build: { |
| 33 | + outDir: "../../dist/packages/ui", |
| 34 | + emptyOutDir: true, |
| 35 | + reportCompressedSize: true, |
| 36 | + commonjsOptions: { |
| 37 | + transformMixedEsModules: true, |
| 38 | + }, |
| 39 | + lib: { |
| 40 | + // Could also be a dictionary or array of multiple entry points. |
| 41 | + entry: "src/index.ts", |
| 42 | + name: "ui", |
| 43 | + fileName: "index", |
| 44 | + // Change this to the formats you want to support. |
| 45 | + // Don't forget to update your package.json as well. |
| 46 | + formats: ["es", "cjs"], |
| 47 | + }, |
| 48 | + rollupOptions: { |
| 49 | + // External packages that should not be bundled into your library. |
| 50 | + external: ["react", "react-dom", "react/jsx-runtime"], |
| 51 | + }, |
| 52 | + }, |
| 53 | + test: { |
| 54 | + watch: false, |
| 55 | + globals: true, |
| 56 | + environment: "jsdom", |
| 57 | + include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], |
| 58 | + reporters: ["default"], |
| 59 | + coverage: { |
| 60 | + reportsDirectory: "../../coverage/packages/ui", |
| 61 | + provider: "v8", |
| 62 | + }, |
| 63 | + }, |
59 | 64 | }); |
0 commit comments