Skip to content

Commit

Permalink
chore: updated vite confs to work outside of monorepo (#169)
Browse files Browse the repository at this point in the history
Co-authored-by: Christiaan Landman <[email protected]>
  • Loading branch information
Chriztiaan and Christiaan Landman authored May 14, 2024
1 parent 3180890 commit c3588c0
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .changeset/witty-scissors-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'yjs-react-supabase-text-collab': patch
'react-supabase-todolist': patch
'vue-supabase-todolist': patch
'example-electron': patch
'example-vite': patch
---

Updated the vite conf include rules for bson, buffer, rsocket and cross-fetch.
7 changes: 6 additions & 1 deletion demos/example-electron/vite.renderer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ export default defineConfig((env) => {
'@powersync/web > event-iterator',
'@powersync/web > js-logger',
'@powersync/web > lodash/throttle',
'@powersync/web > can-ndjson-stream'
'@powersync/web > can-ndjson-stream',
'@powersync/web > bson',
'@powersync/web > buffer',
'@powersync/web > rsocket-core',
'@powersync/web > rsocket-websocket-client',
'@powersync/web > cross-fetch'
]
},
plugins: [
Expand Down
6 changes: 5 additions & 1 deletion demos/example-vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ export default defineConfig({
'@powersync/web > js-logger',
'@powersync/web > lodash/throttle',
'@powersync/web > can-ndjson-stream',
'@powersync/web > bson'
'@powersync/web > bson',
'@powersync/web > buffer',
'@powersync/web > rsocket-core',
'@powersync/web > rsocket-websocket-client',
'@powersync/web > cross-fetch'
]
},
plugins: [wasm(), topLevelAwait()],
Expand Down
6 changes: 5 additions & 1 deletion demos/react-supabase-todolist/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export default defineConfig({
'@powersync/web > js-logger',
'@powersync/web > lodash/throttle',
'@powersync/web > can-ndjson-stream',
'@powersync/web > bson'
'@powersync/web > bson',
'@powersync/web > buffer',
'@powersync/web > rsocket-core',
'@powersync/web > rsocket-websocket-client',
'@powersync/web > cross-fetch'
]
},
plugins: [
Expand Down
18 changes: 13 additions & 5 deletions demos/vue-supabase-todolist/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import ViteFonts from 'unplugin-fonts/vite';
import Components from 'unplugin-vue-components/vite';
import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
import { VitePWA } from 'vite-plugin-pwa';

import { createRequire } from 'node:module';
const require = createRequire(import.meta.url); // Needed since the config file is also an ES module
// Utilities
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
Expand Down Expand Up @@ -69,9 +70,11 @@ export default defineConfig({
],
define: { 'process.env': {} },
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
alias: [
{ find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
// https://jira.mongodb.org/browse/NODE-5773
{ find: 'bson', replacement: require.resolve('bson') }
],
extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue']
},
optimizeDeps: {
Expand All @@ -82,7 +85,12 @@ export default defineConfig({
'@powersync/web > event-iterator',
'@powersync/web > js-logger',
'@powersync/web > lodash/throttle',
'@powersync/web > can-ndjson-stream'
'@powersync/web > can-ndjson-stream',
'@powersync/web > bson',
'@powersync/web > buffer',
'@powersync/web > rsocket-core',
'@powersync/web > rsocket-websocket-client',
'@powersync/web > cross-fetch'
]
},
worker: {
Expand Down
7 changes: 5 additions & 2 deletions demos/yjs-react-supabase-text-collab/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ export default defineConfig({
// https://github.com/vitejs/vite/issues/11672#issuecomment-1415820673
exclude: ['@journeyapps/wa-sqlite', '@powersync/web'],
include: [
'@powersync/web > uuid',
'@powersync/web > event-iterator',
'@powersync/web > js-logger',
'@powersync/web > lodash/throttle',
'@powersync/web > can-ndjson-stream',
'@powersync/web > bson'
'@powersync/web > bson',
'@powersync/web > buffer',
'@powersync/web > rsocket-core',
'@powersync/web > rsocket-websocket-client',
'@powersync/web > cross-fetch'
]
},
plugins: [
Expand Down

0 comments on commit c3588c0

Please sign in to comment.