Skip to content

Commit

Permalink
Merge pull request #62 from reg-viz/chore/fix-vite-config
Browse files Browse the repository at this point in the history
chore: fix vite config
  • Loading branch information
wadackel committed Apr 28, 2024
2 parents e01acc0 + b68ba33 commit 472ef90
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
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
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 472ef90

Please sign in to comment.