From 9704f79804bde08bd4794f4849b00bf57f9b1cf6 Mon Sep 17 00:00:00 2001 From: Tinh Le Duc Date: Sat, 21 Sep 2024 19:07:59 +0700 Subject: [PATCH] Fix build docs --- docs/vite.config.ts | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/vite.config.ts b/docs/vite.config.ts index d09c290..7b5df44 100644 --- a/docs/vite.config.ts +++ b/docs/vite.config.ts @@ -3,19 +3,24 @@ import * as path from 'path'; import react from '@vitejs/plugin-react'; // you can also use @vitejs/plugin-react-swc import pages from 'vite-plugin-react-pages'; -export default defineConfig({ - plugins: [ - react(), - pages({ - pagesDir: path.join(__dirname, 'pages'), - }), - ], - base: 'dnd-tree-sortable/docs/dist', - resolve: { - alias: { - 'dnd-tree-sortable': path.join(__dirname, '../lib'), - react: 'react', - 'react-dom': 'react-dom', +export default defineConfig(() => { + return { + plugins: [ + react(), + pages({ + pagesDir: path.join(__dirname, 'pages'), + }), + ], + base: + process.env.NODE_ENV === 'producton' + ? 'https://ductinhkzz.github.io/dnd-tree-sortable' + : 'dnd-tree-sortable/docs/dist', + resolve: { + alias: { + 'dnd-tree-sortable': path.join(__dirname, '../lib'), + react: 'react', + 'react-dom': 'react-dom', + }, }, - }, + }; });