Framework Configuration
Here, we’ll cover how to configure your project for Pacy. Below is a quick overview of setups that require no configuration and those that do require configuration. Configuration is achieved using the @pacy-dev/plugin-devtools plugin.
No configuration required
Section titled “No configuration required”- React (v17-18) with Vite
- React (v18) with Remix
- Vue (v3) with Vite
- Svelte with Vite
- Next.js (v14, without Turbo)
Configuration required
Section titled “Configuration required”- React (v19) with Vite
- Vue (v2) with Vite
- Next.js (v15)
- Others
Even if your setup requires no configuration, we still recommend using @pacy-dev/plugin-devtools for the smoothest experience and more accurate sourcemaps. This plugin is mostly a wrapper around code-inspector at the moment, and it works by adding data attributes to the DOM elements to track the source code location of the elements.
It supports bundlers such as Webpack, Vite, Esbuild, Rspack / Rsbuild, and Turbopack, and frameworks such as React, Vue, Svelte, Preact, Next.js, Nuxt, Solid, Astro, and Qwik.
Here, confiuration patterns for different setups are listed.
There’s no need to specify the framework.
You only need to specify the bundler.
The plugin does different transforms based on the file extensions such as .jsx
, .tsx
, .vue
, .astro
, .svelte
, etc.
This section is mostly taken from code-inspector’s configuration instructions.
import { defineConfig } from 'vite';import react from '@vitejs/plugin-react'import pacyDevtools from '@pacy-dev/plugin-devtools';
export default defineConfig({ plugins: [ pacyDevtools({ bundler: 'vite', }), react(), ],});
import { defineConfig } from 'vite';import vue from '@vitejs/plugin-vue';import pacyDevtools from '@pacy-dev/plugin-devtools';
export default defineConfig({ plugins: [ pacyDevtools({ bundler: 'vite', }), vue(), ],});
import { defineConfig } from 'vite';import { svelte } from '@sveltejs/vite-plugin-svelte'import pacyDevtools from '@pacy-dev/plugin-devtools';
export default defineConfig({ plugins: [ pacyDevtools({ bundler: 'vite', }), svelte(), ],});
import { defineConfig } from 'vite';import pacyDevtools from '@pacy-dev/plugin-devtools';
export default defineConfig({ plugins: [ pacyDevtools({ bundler: 'vite', }), // Add your framework plugins here ],});
Webpack
Section titled “Webpack”import pacyDevtools from '@pacy-dev/plugin-devtools';
module.exports = () => ({ plugins: [ pacyDevtools({ bundler: 'webpack', }), ],});
Next.js
Section titled “Next.js”const pacyDevtools = require('@pacy-dev/plugin-devtools');
const nextConfig = { webpack: (config, { dev, isServer }) => { config.plugins.push(pacyDevtools({ bundler: 'webpack' })); return config; },};
module.exports = nextConfig;
import type { NextConfig } from 'next';const pacyDevtools = require('@pacy-dev/plugin-devtools');
const nextConfig: NextConfig = { experimental: { turbo: { rules: pacyDevtools({ bundler: 'turbopack', }), }, },};
export default nextConfig;
import type { NextConfig } from 'next';const pacyDevtools = require('@pacy-dev/plugin-devtools');
const nextConfig: NextConfig = { turbopack: { rules: pacyDevtools({ bundler: 'turbopack', }), },};
export default nextConfig;
Esbuild
Section titled “Esbuild”const esbuild = require('esbuild');import pacyDevtools from '@pacy-dev/plugin-devtools';
esbuild.build({ plugins: [pacyDevtools({ bundler: 'esbuild', dev: () => true })],});
Rspack
Section titled “Rspack”import pacyDevtools from '@pacy-dev/plugin-devtools';
module.exports = { plugins: [ pacyDevtools({ bundler: 'rspack', }), // other plugins... ],};
Rsbuild
Section titled “Rsbuild”import pacyDevtools from '@pacy-dev/plugin-devtools';
module.exports = { // other config... tools: { rspack: { plugins: [ pacyDevtools({ bundler: 'rspack', }), ], }, },};
Vue CLI
Section titled “Vue CLI”import pacyDevtools from '@pacy-dev/plugin-devtools';
module.exports = { // ...other config chainWebpack: (config) => { config.plugin('@pacy-dev/plugin-devtools').use( pacyDevtools({ bundler: 'webpack', }) ); },};
For nuxt3.x :
import { pacyDevtools } from '@pacy-dev/plugin-devtools';
// https://nuxt.com/docs/api/configuration/nuxt-configexport default defineNuxtConfig({ vite: { plugins: [pacyDevtools({ bundler: 'vite' })], },});
For nuxt2.x :
import { pacyDevtools } from '@pacy-dev/plugin-devtools';
export default { build: { extend(config) { config.plugins.push(pacyDevtools({ bundler: 'webpack' })); return config; }, },};
import { defineConfig } from 'astro/config';import { pacyDevtools } from '@pacy-dev/plugin-devtools';
export default defineConfig({ vite: { plugins: [pacyDevtools({ bundler: 'vite' })], },});
Acknowledgement
Section titled “Acknowledgement”@pacy-dev/plugin-devtools internally uses code-inspector. Thanks to all its contributors. You can surely use it directly, but we chose to wrap it in a plugin since we’re using it with the following non-default settings:
hideDomPathAttr: true,hotKeys: false,hideConsole: true,pathType: 'absolute'