71 lines
1.8 KiB
JavaScript
71 lines
1.8 KiB
JavaScript
import { defineConfig } from 'astro/config';
|
|
import { loadEnv } from "vite";
|
|
import node from '@astrojs/node';
|
|
import sitemap from '@astrojs/sitemap';
|
|
import react from "@astrojs/react";
|
|
import commonjs from 'vite-plugin-commonjs'
|
|
|
|
const {
|
|
SITE_URL
|
|
} = loadEnv(process.env.NODE_ENV, process.cwd(), "");
|
|
|
|
// this was used for static generation, but now we're using SSR
|
|
// import { ALL_PRODUCTS } from './src/data/products';
|
|
// function generateRedirectsForAmazonProductIds() {
|
|
// let redirects = {};
|
|
// for (let p = 0; p < ALL_PRODUCTS.length; p++) {
|
|
// let product = ALL_PRODUCTS[p];
|
|
// if (product.ASIN && product.slug !== product.ASIN) {
|
|
// redirects[`/${product.ASIN}`] = `/${product.slug}`;
|
|
// }
|
|
// }
|
|
// return redirects;
|
|
// }
|
|
|
|
|
|
// https://astro.build/config
|
|
export default defineConfig({
|
|
site: SITE_URL || 'http://localhost',
|
|
integrations: [sitemap(), react()],
|
|
// redirects: generateRedirectsForAmazonProductIds(),
|
|
output: 'server',
|
|
server: {
|
|
host: '0.0.0.0',
|
|
},
|
|
// i18n: {
|
|
// defaultLocale: 'en',
|
|
// locales: ['en', 'es', 'fr'],
|
|
// },
|
|
adapter: node({
|
|
mode: 'middleware',
|
|
}),
|
|
build: {
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true,
|
|
},
|
|
rollupOptions: {
|
|
external: ['@squidex/squidex', '../squidex-node-sdk'],
|
|
}
|
|
},
|
|
vite: {
|
|
plugins: [
|
|
commonjs(/**/)
|
|
],
|
|
optimizeDeps: {
|
|
exclude: ['@squidex/squidex', '../squidex-node-sdk'],
|
|
}
|
|
// resolve: {
|
|
// alias: [
|
|
// { find: /^swiper\/(.+)/, replacement: 'swiper/$1 '},
|
|
// ],
|
|
// },
|
|
},
|
|
// experimental: {
|
|
// resolveId: (id) => {
|
|
// if (id === 'swiper') {
|
|
// return './node_modules/swiper/swiper.esm.js';
|
|
// }
|
|
// return null;
|
|
// }
|
|
// }
|
|
}); |