mirror of
https://github.com/aljazceru/enclava.git
synced 2025-12-17 07:24:34 +01:00
prod build fix
This commit is contained in:
@@ -11,7 +11,7 @@ WORKDIR /app
|
|||||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||||
RUN \
|
RUN \
|
||||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
||||||
elif [ -f package-lock.json ]; then npm ci; \
|
elif [ -f package-lock.json ]; then npm install && npm ci; \
|
||||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
||||||
else echo "Lockfile not found." && exit 1; \
|
else echo "Lockfile not found." && exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
const path = require('path');
|
||||||
|
let TsconfigPathsPlugin;
|
||||||
|
try {
|
||||||
|
// Optional: only used if installed
|
||||||
|
TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
||||||
|
} catch (_) {}
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
@@ -11,14 +18,34 @@ const nextConfig = {
|
|||||||
},
|
},
|
||||||
// Enable standalone output for better Docker compatibility
|
// Enable standalone output for better Docker compatibility
|
||||||
output: 'standalone',
|
output: 'standalone',
|
||||||
webpack: (config, { isServer, dev }) => {
|
webpack: (config, { dev }) => {
|
||||||
config.resolve.alias = {
|
// Ensure resolve object exists
|
||||||
...config.resolve.alias,
|
config.resolve = config.resolve || {};
|
||||||
'@': require('path').join(__dirname, 'src'),
|
config.resolve.alias = config.resolve.alias || {};
|
||||||
};
|
|
||||||
|
|
||||||
// Optional: Add debug logging
|
// Hard-set robust alias for "@" => <repo>/src
|
||||||
|
config.resolve.alias['@'] = path.resolve(__dirname, 'src');
|
||||||
|
|
||||||
|
// Ensure common extensions are resolvable
|
||||||
|
const exts = config.resolve.extensions || [];
|
||||||
|
config.resolve.extensions = Array.from(new Set([...exts, '.ts', '.tsx', '.js', '.jsx']));
|
||||||
|
|
||||||
|
// Add tsconfig-aware resolver plugin if available
|
||||||
|
if (TsconfigPathsPlugin) {
|
||||||
|
const existing = config.resolve.plugins || [];
|
||||||
|
existing.push(
|
||||||
|
new TsconfigPathsPlugin({
|
||||||
|
configFile: path.resolve(__dirname, 'tsconfig.json'),
|
||||||
|
extensions: config.resolve.extensions,
|
||||||
|
mainFields: ['browser', 'module', 'main'],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
config.resolve.plugins = existing;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional: Add debug logging in development
|
||||||
if (dev) {
|
if (dev) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log('Webpack alias config:', config.resolve.alias);
|
console.log('Webpack alias config:', config.resolve.alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
||||||
"@hookform/resolvers": "^3.3.2",
|
"@hookform/resolvers": "^3.3.2",
|
||||||
"@radix-ui/react-alert-dialog": "^1.1.14",
|
"@radix-ui/react-alert-dialog": "^1.1.14",
|
||||||
"@radix-ui/react-avatar": "^1.0.4",
|
"@radix-ui/react-avatar": "^1.0.4",
|
||||||
|
|||||||
Reference in New Issue
Block a user