File tree Expand file tree Collapse file tree 4 files changed +30
-4
lines changed
Expand file tree Collapse file tree 4 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,28 @@ import { PHASE_DEVELOPMENT_SERVER } from "next/constants.js";
55const __filename = fileURLToPath ( import . meta. url ) ;
66const __dirname = path . dirname ( __filename ) ;
77
8+ const componentsSrc = path . resolve ( __dirname , "../diracx-web-components/src" ) ;
9+
810export default ( phase ) => {
911 const isDev = phase === PHASE_DEVELOPMENT_SERVER ;
1012
1113 return {
1214 transpilePackages : [ "@dirac-grid/diracx-web-components" ] ,
1315 ...( isDev && {
1416 webpack : ( config ) => {
17+ // In dev mode, resolve diracx-web-components imports to source
18+ // files for HMR. Each subpath must be aliased explicitly because
19+ // webpack 5 resolves package exports before resolve.alias.
20+ config . resolve . alias [ "@dirac-grid/diracx-web-components/components" ] =
21+ path . join ( componentsSrc , "components" ) ;
22+ config . resolve . alias [ "@dirac-grid/diracx-web-components/contexts" ] =
23+ path . join ( componentsSrc , "contexts" ) ;
24+ config . resolve . alias [ "@dirac-grid/diracx-web-components/hooks" ] =
25+ path . join ( componentsSrc , "hooks" ) ;
26+ config . resolve . alias [ "@dirac-grid/diracx-web-components/types" ] =
27+ path . join ( componentsSrc , "types" ) ;
1528 config . resolve . alias [ "@dirac-grid/diracx-web-components" ] =
16- path . resolve ( __dirname , "../diracx-web-components/src" ) ;
29+ componentsSrc ;
1730 return config ;
1831 } ,
1932 } ) ,
Original file line number Diff line number Diff line change 44 "private" : true ,
55 "type" : " module" ,
66 "scripts" : {
7- "dev" : " export NEXT_PUBLIC_DIRACX_URL=$DIRACX_URL; next dev" ,
7+ "dev" : " export NEXT_PUBLIC_DIRACX_URL=$DIRACX_URL; next dev --webpack " ,
88 "build" : " next build" ,
99 "test" : " cypress open --config baseUrl=$DIRACX_URL" ,
1010 "start" : " next start" ,
Original file line number Diff line number Diff line change @@ -5,15 +5,28 @@ import { PHASE_DEVELOPMENT_SERVER } from "next/constants.js";
55const __filename = fileURLToPath ( import . meta. url ) ;
66const __dirname = path . dirname ( __filename ) ;
77
8+ const componentsSrc = path . resolve ( __dirname , "../diracx-web-components/src" ) ;
9+
810export default ( phase ) => {
911 const isDev = phase === PHASE_DEVELOPMENT_SERVER ;
1012
1113 return {
1214 transpilePackages : [ "@dirac-grid/diracx-web-components" ] ,
1315 ...( isDev && {
1416 webpack : ( config ) => {
17+ // In dev mode, resolve diracx-web-components imports to source
18+ // files for HMR. Each subpath must be aliased explicitly because
19+ // webpack 5 resolves package exports before resolve.alias.
20+ config . resolve . alias [ "@dirac-grid/diracx-web-components/components" ] =
21+ path . join ( componentsSrc , "components" ) ;
22+ config . resolve . alias [ "@dirac-grid/diracx-web-components/contexts" ] =
23+ path . join ( componentsSrc , "contexts" ) ;
24+ config . resolve . alias [ "@dirac-grid/diracx-web-components/hooks" ] =
25+ path . join ( componentsSrc , "hooks" ) ;
26+ config . resolve . alias [ "@dirac-grid/diracx-web-components/types" ] =
27+ path . join ( componentsSrc , "types" ) ;
1528 config . resolve . alias [ "@dirac-grid/diracx-web-components" ] =
16- path . resolve ( __dirname , "../diracx-web-components/src" ) ;
29+ componentsSrc ;
1730 return config ;
1831 } ,
1932 } ) ,
Original file line number Diff line number Diff line change 55 "type" : " module" ,
66 "license" : " GPL-3.0-only" ,
77 "scripts" : {
8- "dev" : " export NEXT_PUBLIC_DIRACX_URL=$DIRACX_URL; next dev" ,
8+ "dev" : " export NEXT_PUBLIC_DIRACX_URL=$DIRACX_URL; next dev --webpack " ,
99 "build" : " next build" ,
1010 "test" : " cypress open --config baseUrl=$DIRACX_URL" ,
1111 "start" : " next start" ,
You can’t perform that action at this time.
0 commit comments