@@ -3,6 +3,13 @@ import react from '@vitejs/plugin-react'
33import * as path from 'path'
44import { nodeResolve } from '@rollup/plugin-node-resolve'
55
6+ const alias : Record < string , string > = { }
7+
8+ // add local path in development to make vite use sources directly avoiding build step
9+ if ( process . env . NODE_ENV !== 'production' ) {
10+ alias [ '@codegouvfr/rjsf-dsfr' ] = path . resolve ( __dirname , '../src' )
11+ }
12+
613// https://vitejs.dev/config/
714export default defineConfig ( {
815 // base needs to be changed for links to work in GitHub pages
@@ -15,34 +22,16 @@ export default defineConfig({
1522 build : {
1623 rollupOptions : {
1724 external : [
18- '@rjsf/core' ,
19- '@rjsf/utils' ,
20- '@rjsf/validator-ajv8' ,
21- '@rjsf/bootstrap-4' ,
25+ // '@rjsf/core',
26+ // '@rjsf/utils',
27+ // '@rjsf/validator-ajv8',
28+ // '@rjsf/bootstrap-4',
2229 ] ,
2330 plugins : [ nodeResolve ( ) ] ,
2431 } ,
2532 } ,
2633 resolve : {
2734 preserveSymlinks : true , // Fixes https://github.com/rjsf-team/react-jsonschema-form/issues/3228
28- alias : {
29- // mapping packages in monorepo to make vite use sources directly avoiding build step
30- '@codegouvfr/rjsf-dsfr' : path . resolve ( __dirname , '../src' ) ,
31- // '@rjsf/bootstrap-4': path.resolve(__dirname, '../bootstrap-4/src'),
32- // '@rjsf/chakra-ui': path.resolve(__dirname, '../chakra-ui/src'),
33- // '@rjsf/core': path.resolve(__dirname, '../core/src'),
34- // '@rjsf/fluent-ui': path.resolve(__dirname, '../fluent-ui/src'),
35- // '@rjsf/fluentui-rc': path.resolve(__dirname, '../fluentui-rc/src'),
36- // '@rjsf/material-ui': path.resolve(__dirname, '../material-ui/src'),
37- // '@rjsf/mui': path.resolve(__dirname, '../mui/src'),
38- // '@rjsf/semantic-ui': path.resolve(__dirname, '../semantic-ui/src'),
39- // '@rjsf/utils': path.resolve(__dirname, '../utils/src'),
40- // '@rjsf/validator-ajv8': path.resolve(__dirname, '../validator-ajv8/src'),
41- // validator-ajv6 can not be mapped directly to the sources, because that causes wrong ajv version resolution
42- // which looks related to: https://github.com/vitejs/vite/issues/12618
43- //
44- // the difference when mapping directly vs mapping to src folder - @vitejs/plugin-react can not be applied in the 2nd case
45- // '@rjsf/validator-ajv6': '@rjsf/validator-ajv6/src',
46- } ,
35+ alias,
4736 } ,
4837} )
0 commit comments