mmh
continuous-integration/drone/push Build is passing Details

master
37b7 3 weeks ago
parent 3e2c89ea18
commit dd0518bcd3

@ -1,13 +1,7 @@
import { useRuntimeConfig } from '#imports';
const getBasePath = (): string => {
try {
const config = useRuntimeConfig();
return config.public.basePath;
} catch (e) {
console.error('Error getting base path:', e);
return process.env.NODE_ENV === 'production' ? process.env.BASE_PATH || '/' : '/';
}
return process.env.NODE_ENV === 'production' ? process.env.BASE_PATH || '/' : '/';
};

@ -1,11 +1,6 @@
FROM node:18-alpine as builder
WORKDIR /app
COPY package*.json ./
ENV NODE_ENV=production
ENV BASE_PATH=/containers/matheothierry-portfolio_nuxt
ENV CDN_URL=https://codefirst.iut.uca.fr
ENV HOST=0.0.0.0
ENV PORT=3000
RUN npm install
COPY . .
RUN npm run build
@ -18,7 +13,7 @@ COPY --from=builder /app/public ./public
COPY --from=builder /app/.nuxt ./.nuxt
RUN npm install --production
ENV NODE_ENV=production
ENV BASE_PATH=/containers/matheothierry-portfolio_nuxt
ENV BASE_PATH=/
ENV CDN_URL=https://codefirst.iut.uca.fr
ENV HOST=0.0.0.0
ENV PORT=3000

@ -62,10 +62,4 @@ export default defineNuxtConfig({
maxAge: 60 * 60 * 24 * 30
},
},
runtimeConfig: {
public: {
basePath: process.env.NODE_ENV === 'production' ? process.env.BASE_PATH : '/'
}
}
})

@ -4,8 +4,8 @@ export default defineNuxtPlugin({
setup(nuxtApp) {
nuxtApp.hook('app:error', (error) => {
if (error.statusCode === 404 && process.client) {
const basePath = process.env.NODE_ENV === 'production' ? '/containers/matheothierry-portfolio_nuxt' : '/'
error.path = window.location.pathname.replace(basePath, '')
const basePath = process.env.NODE_ENV === 'production' ? process.env.BASE_PATH : '/'
error.path = window.location.pathname.replace(basePath as string, '')
}
})

Loading…
Cancel
Save