Skip to content

Commit 8f4ff06

Browse files
authored
Fix frontend build (#67)
* Fix container build (?) * Add script for testing the image * Reinstate [username] component * Fix path to static page in container * Add a get-blockfrost-key route * Load blockfrost key from backend * Use key from BE for lucid * Enable container builds * delete debug-image script * Delete unused dependencies * Update nix * Empty deps. in ClientLayout
1 parent ebd5ea4 commit 8f4ff06

File tree

15 files changed

+393
-4262
lines changed

15 files changed

+393
-4262
lines changed

.github/workflows/ci-oci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@ jobs:
7575
purge-primary-key: never
7676

7777
- name: Build image with nix
78-
if: False
7978
run: nix build --accept-flake-config .#containers.x86_64-linux.${{ matrix.image }}.copyTo
8079
- name: Publish tagged image with podman
81-
if: False
8280
run: |
8381
IMAGE_NAME=ghcr.io/${{github.repository_owner}}/${{ matrix.image }}:$IMAGE_TAG
8482
./result/bin/copy-to oci-archive:oci.tar

frontend/.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": ["next/core-web-vitals", "next/typescript"]
2+
"extends": ["next/core-web-vitals", "next/typescript"],
3+
"rules": {
4+
"@next/next/no-page-custom-font": "off"
5+
}
36
}

frontend/next.config.js

Lines changed: 72 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,76 @@
11
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
22

3+
/**
4+
* Webpack config used by export and dev builds
5+
* @param {*} config
6+
* @param {*} param1
7+
* @returns
8+
*/
9+
const webpackConfig = (config, { isServer }) => {
10+
// Ensure `resolve.plugins` exists
11+
config.resolve.plugins = [
12+
...(config.resolve.plugins || []), // Keep existing plugins
13+
new TsconfigPathsPlugin({
14+
configFile: './tsconfig.json', // Adjust the path to your tsconfig.json if necessary
15+
}),
16+
];
17+
18+
config.experiments = {
19+
...config.experiments,
20+
asyncWebAssembly: true, // Enable async WebAssembly
21+
topLevelAwait: true,
22+
layers: true
23+
};
24+
if (!isServer) {
25+
config.output.environment = { ...config.output.environment, asyncFunction: true };
26+
}
27+
28+
// Add fallback and resolve configurations for browser compatibility
29+
config.resolve = {
30+
...config.resolve,
31+
extensions: ['.ts', '.tsx', '.js', '.mjs'],
32+
fallback: {
33+
https: require.resolve('https-browserify'),
34+
http: require.resolve('stream-http'),
35+
'get-port-please': false,
36+
net: false,
37+
fs: false,
38+
os: false,
39+
path: false,
40+
events: require.resolve('events/'),
41+
buffer: require.resolve('buffer/'),
42+
stream: require.resolve('readable-stream'),
43+
crypto: require.resolve('crypto-browserify'),
44+
constants: require.resolve('constants-browserify'),
45+
zlib: require.resolve('browserify-zlib'),
46+
dns: false,
47+
tls: false,
48+
process: false,
49+
child_process: false,
50+
},
51+
};
52+
53+
return config;
54+
};
55+
56+
/**
57+
* Next.js config that produces a static page
58+
*/
59+
const nextConfigExport = {
60+
output: 'export',
61+
webpack: webpackConfig,
62+
experimental: {
63+
esmExternals: true, // Ensure modern module support
64+
},
65+
66+
// https://github.com/Anastasia-Labs/lucid-evolution/issues/437
67+
serverExternalPackages: [
68+
"@lucid-evolution/lucid"
69+
]
70+
}
371

472
/** @type {import('next').NextConfig} */
5-
const nextConfig = {
73+
const nextConfigDev = {
674
// output: 'export',
775
serverExternalPackages: [
876
"@lucid-evolution/lucid",
@@ -41,53 +109,10 @@ const nextConfig = {
41109
experimental: {
42110
esmExternals: true, // Ensure modern module support
43111
},
44-
webpack: (config, { isServer }) => {
45-
// Ensure `resolve.plugins` exists
46-
config.resolve.plugins = [
47-
...(config.resolve.plugins || []), // Keep existing plugins
48-
new TsconfigPathsPlugin({
49-
configFile: './tsconfig.json', // Adjust the path to your tsconfig.json if necessary
50-
}),
51-
];
52-
53-
config.experiments = {
54-
...config.experiments,
55-
asyncWebAssembly: true, // Enable async WebAssembly
56-
topLevelAwait: true,
57-
layers: true
58-
};
59-
if (!isServer) {
60-
config.output.environment = { ...config.output.environment, asyncFunction: true };
61-
}
62-
63-
// Add fallback and resolve configurations for browser compatibility
64-
config.resolve = {
65-
...config.resolve,
66-
extensions: ['.ts', '.tsx', '.js', '.mjs'],
67-
fallback: {
68-
https: require.resolve('https-browserify'),
69-
http: require.resolve('stream-http'),
70-
'get-port-please': false,
71-
net: false,
72-
fs: false,
73-
os: false,
74-
path: false,
75-
events: require.resolve('events/'),
76-
buffer: require.resolve('buffer/'),
77-
stream: require.resolve('readable-stream'),
78-
crypto: require.resolve('crypto-browserify'),
79-
constants: require.resolve('constants-browserify'),
80-
zlib: require.resolve('browserify-zlib'),
81-
dns: false,
82-
tls: false,
83-
process: false,
84-
child_process: false,
85-
},
86-
};
87-
88-
return config;
89-
},
112+
webpack: webpackConfig
90113
};
91114

115+
const nextConfig = (process.env.WST_BUILD === 'export') ? nextConfigExport : nextConfigDev;
116+
92117
module.exports = nextConfig;
93118

0 commit comments

Comments
 (0)