Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix frontend build #67

Merged
merged 15 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci-oci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ jobs:
purge-primary-key: never

- name: Build image with nix
if: False
run: nix build --accept-flake-config .#containers.x86_64-linux.${{ matrix.image }}.copyTo
- name: Publish tagged image with podman
if: False
run: |
IMAGE_NAME=ghcr.io/${{github.repository_owner}}/${{ matrix.image }}:$IMAGE_TAG
./result/bin/copy-to oci-archive:oci.tar
Expand Down
5 changes: 4 additions & 1 deletion frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": ["next/core-web-vitals", "next/typescript"]
"extends": ["next/core-web-vitals", "next/typescript"],
"rules": {
"@next/next/no-page-custom-font": "off"
}
}
119 changes: 72 additions & 47 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,76 @@
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');

/**
* Webpack config used by export and dev builds
* @param {*} config
* @param {*} param1
* @returns
*/
const webpackConfig = (config, { isServer }) => {
// Ensure `resolve.plugins` exists
config.resolve.plugins = [
...(config.resolve.plugins || []), // Keep existing plugins
new TsconfigPathsPlugin({
configFile: './tsconfig.json', // Adjust the path to your tsconfig.json if necessary
}),
];

config.experiments = {
...config.experiments,
asyncWebAssembly: true, // Enable async WebAssembly
topLevelAwait: true,
layers: true
};
if (!isServer) {
config.output.environment = { ...config.output.environment, asyncFunction: true };
}

// Add fallback and resolve configurations for browser compatibility
config.resolve = {
...config.resolve,
extensions: ['.ts', '.tsx', '.js', '.mjs'],
fallback: {
https: require.resolve('https-browserify'),
http: require.resolve('stream-http'),
'get-port-please': false,
net: false,
fs: false,
os: false,
path: false,
events: require.resolve('events/'),
buffer: require.resolve('buffer/'),
stream: require.resolve('readable-stream'),
crypto: require.resolve('crypto-browserify'),
constants: require.resolve('constants-browserify'),
zlib: require.resolve('browserify-zlib'),
dns: false,
tls: false,
process: false,
child_process: false,
},
};

return config;
};

/**
* Next.js config that produces a static page
*/
const nextConfigExport = {
output: 'export',
webpack: webpackConfig,
experimental: {
esmExternals: true, // Ensure modern module support
},

// https://github.com/Anastasia-Labs/lucid-evolution/issues/437
serverExternalPackages: [
"@lucid-evolution/lucid"
]
}

/** @type {import('next').NextConfig} */
const nextConfig = {
const nextConfigDev = {
// output: 'export',
serverExternalPackages: [
"@lucid-evolution/lucid",
Expand Down Expand Up @@ -41,53 +109,10 @@ const nextConfig = {
experimental: {
esmExternals: true, // Ensure modern module support
},
webpack: (config, { isServer }) => {
// Ensure `resolve.plugins` exists
config.resolve.plugins = [
...(config.resolve.plugins || []), // Keep existing plugins
new TsconfigPathsPlugin({
configFile: './tsconfig.json', // Adjust the path to your tsconfig.json if necessary
}),
];

config.experiments = {
...config.experiments,
asyncWebAssembly: true, // Enable async WebAssembly
topLevelAwait: true,
layers: true
};
if (!isServer) {
config.output.environment = { ...config.output.environment, asyncFunction: true };
}

// Add fallback and resolve configurations for browser compatibility
config.resolve = {
...config.resolve,
extensions: ['.ts', '.tsx', '.js', '.mjs'],
fallback: {
https: require.resolve('https-browserify'),
http: require.resolve('stream-http'),
'get-port-please': false,
net: false,
fs: false,
os: false,
path: false,
events: require.resolve('events/'),
buffer: require.resolve('buffer/'),
stream: require.resolve('readable-stream'),
crypto: require.resolve('crypto-browserify'),
constants: require.resolve('constants-browserify'),
zlib: require.resolve('browserify-zlib'),
dns: false,
tls: false,
process: false,
child_process: false,
},
};

return config;
},
webpack: webpackConfig
};

const nextConfig = (process.env.WST_BUILD === 'export') ? nextConfigExport : nextConfigDev;

module.exports = nextConfig;

Loading
Loading