11/// <reference types="vitest" />
22import { defineConfig } from 'vite' ;
33import react from '@vitejs/plugin-react' ;
4- import viteTsConfigPaths from 'vite-tsconfig-paths' ;
54import dts from 'vite-plugin-dts' ;
6- import { join } from 'path' ;
75import { viteStaticCopy } from 'vite-plugin-static-copy' ;
6+ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin' ;
7+ import { joinPathFragments } from 'nx/src/utils/path' ;
88
99export default defineConfig ( {
10+ root : __dirname ,
1011 cacheDir : '../../node_modules/.vite/use-long-press' ,
1112
1213 plugins : [
1314 dts ( {
1415 entryRoot : 'src' ,
15- tsConfigFilePath : join ( __dirname , 'tsconfig.lib.json' ) ,
16+ tsConfigFilePath : joinPathFragments ( __dirname , 'tsconfig.lib.json' ) ,
1617 skipDiagnostics : true ,
1718 } ) ,
1819 react ( ) ,
19- viteTsConfigPaths ( {
20- root : '../../' ,
21- } ) ,
20+ nxViteTsPaths ( ) ,
2221 viteStaticCopy ( {
2322 targets : [
2423 {
@@ -42,6 +41,9 @@ export default defineConfig({
4241 // See: https://vitejs.dev/guide/build.html#library-mode
4342 build : {
4443 emptyOutDir : true ,
44+ outDir : '../../dist/packages/use-long-press' ,
45+ reportCompressedSize : true ,
46+ commonjsOptions : { transformMixedEsModules : true } ,
4547 lib : {
4648 // Could also be a dictionary or array of multiple entry points.
4749 entry : 'src/index.ts' ,
@@ -58,6 +60,7 @@ export default defineConfig({
5860 } ,
5961
6062 test : {
63+ reporters : [ 'default' ] ,
6164 globals : true ,
6265 setupFiles : 'src/tests/setup-tests.ts' ,
6366 environment : 'jsdom' ,
0 commit comments