Skip to content

Commit

Permalink
Fix prod build errors by disabling manual chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
Erudition committed Nov 20, 2023
1 parent 3f88789 commit 3e8db56
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { VitePWA } from 'vite-plugin-pwa'

export default defineConfig({
// identify what plugins we want to use
plugins: [ // PWA plugin causing import errors
plugins: [ // PWA plugin causing capacitor errors
VitePWA({ registerType: 'autoUpdate',
// After messing with service worker you may need to rm -rf android/app/src/main/assets/* before sync. https://github.com/ionic-team/capacitor/issues/5430#issuecomment-1042990925
//devOptions: {enabled: true},
Expand Down Expand Up @@ -62,24 +62,24 @@ export default defineConfig({
//maxParallelFileOps: 2,
output: {
sourcemap: true, //don't sourcemap node_modules?
manualChunks: (id) => {
// this makes node_modules manually chunked so we don't have a huge index.ts file or too many micro js files
if (id.includes('capacitor')) {
return 'capacitor-modules';
} else if (id.includes('libp2p')) {
return 'libp2p-modules';
} else if (id.includes('ipfs') || id.includes('helia') || id.includes('multiaddr') || id.includes('multiformats')) {
return 'ipfs-modules';
} else if (id.includes('orbit') || id.includes('orbit-db') || id.includes('dids') || id.includes('apg-js')) {
return 'orbit-modules';
} else if (id.includes('ionic') || id.includes('ion-')) {
return 'ionic-modules';
} else if (id.includes('elm')) {
return 'elm-modules';
} else if (id.includes('node_modules')) {
return 'other-modules';
}
},
// manualChunks: (id) => {
// // this makes node_modules manually chunked so we don't have a huge index.ts file or too many micro js files
// if (id.includes('capacitor')) {
// return 'capacitor-modules';
// } else if (id.includes('libp2p')) {
// return 'libp2p-modules';
// } else if (id.includes('ipfs') || id.includes('helia') || id.includes('multiaddr') || id.includes('multiformats')) {
// return 'ipfs-modules';
// } else if (id.includes('orbit') || id.includes('orbit-db') || id.includes('dids') || id.includes('apg-js')) {
// return 'orbit-modules';
// } else if (id.includes('ionic') || id.includes('ion-')) {
// return 'ionic-modules';
// } else if (id.includes('elm')) {
// return 'elm-modules';
// } else if (id.includes('node_modules')) {
// return 'other-modules';
// }
// },
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<link rel="icon" href="./media/logos/Minder/alpha-logo.png">

<!-- HACK dev mode only, get Ionicons rendering (must before main script)-->
<script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
<script type="module" defer src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>

<link rel="stylesheet" href="styles/style.css">
<link rel="stylesheet" href="styles/sliders.css">
Expand Down
2 changes: 1 addition & 1 deletion www/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function elmStarted(app) {
Toast.show({ text: window.location.href, duration: "short"}).then();
try {
//attachOrbit(app);
attachODDManual(app);
//attachODDManual(app);
} catch (problemWithOrbit)
{
console.error("Failed to attach Orbit to Elm!", problemWithOrbit)
Expand Down

0 comments on commit 3e8db56

Please sign in to comment.