Skip to content

Commit

Permalink
Chore: fix vite import deps (local against github source) (#58)
Browse files Browse the repository at this point in the history
* chore: fix vite import deps (local against github source)
  • Loading branch information
Thomas authored Jun 25, 2024
1 parent ec983b2 commit 4596080
Showing 1 changed file with 39 additions and 16 deletions.
55 changes: 39 additions & 16 deletions layer/nuxt-config/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,29 @@ import { ViteConfig } from '@nuxt/schema'
import { createResolver } from '@nuxt/kit'
import { nodePolyfills } from '@bangjelkoski/vite-plugin-node-polyfills'

const isLocalLayer = process.env.LOCAL_LAYER === 'true'
const isProduction = process.env.NODE_ENV === 'production'

const buildSourceMap = process.env.BUILD_SOURCEMAP !== 'false'
const { resolve } = createResolver(import.meta.url)

// deps affecting local build against github source
const additionalDeps = [
'bs58',
'bn.js',
'eventemitter3',
'@solana/web3.js',
'@cosmjs/stargate',
'@cosmjs/launchpad',
'@solana/buffer-layout',
'@injectivelabs/grpc-web',
'jayson/lib/client/browser',
'@cosmostation/extension-client',
'jayson/lib/client/browser/index',
'@cosmostation/extension-client/error',
'@cosmostation/extension-client/index'
]

export default defineConfig({
plugins: [tsconfigPaths(), nodePolyfills({ protocolImports: true })],

Expand Down Expand Up @@ -49,22 +69,25 @@ export default defineConfig({
},

optimizeDeps: {
include: [
'date-fns',
'vue-imask',
'vue-hotjar',
'apexcharts',
'lottie-web',
'js-confetti',
'date-fns-tz',
'floating-vue',
'canvas-confetti',
'lightweight-charts',
'@injectivelabs/utils',
'@injectivelabs/sdk-ts',
'@injectivelabs/wallet-ts',
'@vueuse/integrations/useQRCode'
],
include: isProduction
? []
: [
'date-fns',
'vue-imask',
'vue-hotjar',
'apexcharts',
'lottie-web',
'js-confetti',
'date-fns-tz',
'floating-vue',
'canvas-confetti',
'lightweight-charts',
'@injectivelabs/utils',
'@injectivelabs/sdk-ts',
'@injectivelabs/wallet-ts',
'@vueuse/integrations/useQRCode',
...(isLocalLayer ? [] : additionalDeps)
],
exclude: ['fsevents']
}
}) as ViteConfig
Expand Down

0 comments on commit 4596080

Please sign in to comment.