Skip to content

Commit

Permalink
change build mode for website
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufff committed Aug 16, 2023
1 parent ca6da84 commit bebe6ed
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import path from 'path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from "path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
export default defineConfig(({ mode }) => ({
plugins: [react()],
build: {
lib: {
entry: path.resolve(__dirname, 'src/lib/index.ts'),
name: 'react-weekview',
fileName: (format) => `index.${format}.js`
},
rollupOptions: {
external: ['react', 'react-dom'],
output: {
globals: {
react: 'React'
build:
mode !== "web"
? {
lib: {
entry: path.resolve(__dirname, "src/lib/index.ts"),
name: "react-weekview",
fileName: (format) => `index.${format}.js`,
},
rollupOptions: {
external: ["react", "react-dom", "date-fns"],
output: {
globals: {
react: "React",
"date-fns": "dateFns",
},
},
},
}
}
}
}
})
: undefined,
}));

0 comments on commit bebe6ed

Please sign in to comment.