Skip to content

Commit 4d779cc

Browse files
authored
Merge pull request #3293 from pyth-network/bduran/better-web-app-dx
feat: improved DX by making component library and react hooks uncompiled so no compilation step is required
2 parents f692c1b + f1ead64 commit 4d779cc

File tree

9 files changed

+135
-351
lines changed

9 files changed

+135
-351
lines changed

apps/api-reference/next.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ export default {
2222
use: ["@svgr/webpack"],
2323
});
2424

25+
// make Next.js aware of how to import uncompiled TypeScript files
26+
// from our component-library and other shared packages
2527
config.resolve.extensionAlias = {
26-
".js": [".js", ".ts", ".tsx"],
28+
".js": [".ts", ".tsx", ".js", ".jsx"],
29+
".jsx": [".tsx", ".jsx"],
30+
".mjs": [".mts", ".mjs"],
31+
".cjs": [".cts", ".cjs"],
2732
};
2833

2934
return config;

apps/developer-hub/next.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ const config = {
1616
use: ["@svgr/webpack"],
1717
});
1818

19+
// make Next.js aware of how to import uncompiled TypeScript files
20+
// from our component-library and other shared packages
21+
config.resolve.extensionAlias = {
22+
".js": [".ts", ".tsx", ".js", ".jsx"],
23+
".jsx": [".tsx", ".jsx"],
24+
".mjs": [".mts", ".mjs"],
25+
".cjs": [".cts", ".cjs"],
26+
};
27+
1928
return config;
2029
},
2130

apps/entropy-explorer/next.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ const config = {
3434
test: /\.svg$/i,
3535
use: ["@svgr/webpack"],
3636
});
37+
38+
// make Next.js aware of how to import uncompiled TypeScript files
39+
// from our component-library and other shared packages
40+
config.resolve.extensionAlias = {
41+
".js": [".ts", ".tsx", ".js", ".jsx"],
42+
".jsx": [".tsx", ".jsx"],
43+
".mjs": [".mts", ".mjs"],
44+
".cjs": [".cts", ".cjs"],
45+
};
46+
3747
return config;
3848
},
3949

apps/insights/next.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @type {import('next').NextConfig} */
12
const config = {
23
experimental: {
34
useCache: true,
@@ -28,6 +29,15 @@ const config = {
2829
use: ["@svgr/webpack"],
2930
});
3031

32+
// make Next.js aware of how to import uncompiled TypeScript files
33+
// from our component-library and other shared packages
34+
config.resolve.extensionAlias = {
35+
".js": [".ts", ".tsx", ".js", ".jsx"],
36+
".jsx": [".tsx", ".jsx"],
37+
".mjs": [".mts", ".mjs"],
38+
".cjs": [".cts", ".cjs"],
39+
};
40+
3141
return config;
3242
},
3343

apps/staking/next.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ export default {
1515
use: ["@svgr/webpack"],
1616
});
1717

18+
// make Next.js aware of how to import uncompiled TypeScript files
19+
// from our component-library and other shared packages
1820
config.resolve.extensionAlias = {
19-
".js": [".js", ".ts", ".tsx"],
21+
".js": [".ts", ".tsx", ".js", ".jsx"],
22+
".jsx": [".tsx", ".jsx"],
23+
".mjs": [".mts", ".mjs"],
24+
".cjs": [".cts", ".cjs"],
2025
};
2126

2227
return config;

governance/xc_admin/packages/xc_admin_frontend/next.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const path = require('path')
1+
const path = require('node:path')
22

33
/** @type {import('next').NextConfig} */
44
const nextConfig = {
@@ -21,6 +21,15 @@ const nextConfig = {
2121
'@images': path.resolve(__dirname, 'images/'),
2222
}
2323

24+
// make Next.js aware of how to import uncompiled TypeScript files
25+
// from our component-library and other shared packages
26+
config.resolve.extensionAlias = {
27+
'.js': ['.ts', '.tsx', '.js', '.jsx'],
28+
'.jsx': ['.tsx', '.jsx'],
29+
'.mjs': ['.mts', '.mjs'],
30+
'.cjs': ['.cts', '.cjs'],
31+
}
32+
2433
return config
2534
},
2635
}

0 commit comments

Comments
 (0)