Nuxt Module
API reference for the Polyq Nuxt module.
Nuxt Module
polyq/nuxt — Adds polyfills, schema sync, and optimizeDeps to your Nuxt app.
Usage
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['polyq/nuxt'],
}) With Inline Options
export default defineNuxtConfig({
modules: ['polyq/nuxt'],
polyq: {
polyfills: { buffer: true },
schemaSync: {
mapping: {
my_program: ['packages/sdk/src/idl.json'],
},
},
},
}) Auto-Config Loading
When no inline options are provided, the Nuxt module automatically tries to load polyq.config.ts from your project root. This means you can keep all Polyq config in one place:
// nuxt.config.ts — zero config
export default defineNuxtConfig({
modules: ['polyq/nuxt'],
})
// polyq.config.ts — all settings here
export default definePolyqConfig({
schemaSync: { mapping: { ... } },
polyfills: { buffer: true },
}) What It Does
- Adds polyfill Vite plugin —
polyqPolyfills()with your options - Adds schema sync plugin —
polyqIdlSync()if configured - Merges optimizeDeps — Directly injects
buffer,@coral-xyz/anchor,bn.js,@solana/web3.js,bs58into Vite’soptimizeDeps.includevia thevite:extendConfighook
Config Key
The module uses polyq as its config key:
export default defineNuxtConfig({
polyq: {
// PolyqConfig options
},
})