Skip to content

Commit

Permalink
chore: fix vite config
Browse files Browse the repository at this point in the history
  • Loading branch information
wadackel committed Apr 28, 2024
1 parent 4d29d1e commit b68ba33
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
43 changes: 26 additions & 17 deletions vite.config.source.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,30 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';

export default defineConfig(({ mode }) => ({
build: {
emptyOutDir: false,
copyPublicDir: false,
lib: {
entry: path.resolve(__dirname, 'src/index.tsx'),
name: 'report',
formats: ['umd'],
fileName: () => 'report.js',
export default defineConfig(({ mode }) => {
const value = (dev, fallback) => (mode === 'development' ? dev : fallback);

return {
define: {
'process.env.NODE_ENV': JSON.stringify(
value('development', 'production'),
),
},
build: {
emptyOutDir: false,
copyPublicDir: false,
lib: {
entry: path.resolve(__dirname, 'src/index.tsx'),
name: 'report',
formats: ['umd'],
fileName: () => 'report.js',
},
},
},
plugins: [
react(),
vanillaExtractPlugin({
identifiers: mode === 'development' ? 'debug' : 'short',
}),
],
}));
plugins: [
react(),
vanillaExtractPlugin({
identifiers: mode === 'development' ? 'debug' : 'short',
}),
],
};
});
5 changes: 5 additions & 0 deletions vite.config.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export default defineConfig(({ mode }) => {

return {
clearScreen: false,
define: {
'process.env.NODE_ENV': JSON.stringify(
value('development', 'production'),
),
},
build: {
emptyOutDir: false,
copyPublicDir: false,
Expand Down

0 comments on commit b68ba33

Please sign in to comment.