Skip to content

Framework Configuration

In this section, we’ll cover how to configure your project for Pacy Devtools. First of all, Framework configuration is not required for sending prompts to your IDEs and AI agents, but it’s usually required for the “Edit” mode to work. For the following setups, the configuration might be optional, but we still recommend using @pacy-dev/plugin-devtools:

  • React (v17-18) with Vite
  • React (v18) with Remix
  • Vue (v3) with Vite
  • Svelte with Vite
  • Next.js (v14, without Turbo)

@pacy-dev/plugin-devtools 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.

vite.config.js
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(),
],
});
webpack.config.js
import pacyDevtools from '@pacy-dev/plugin-devtools';
module.exports = () => ({
plugins: [
pacyDevtools({
bundler: 'webpack',
}),
],
});
next.config.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;
esbuild.config.js
const esbuild = require('esbuild');
import pacyDevtools from '@pacy-dev/plugin-devtools';
esbuild.build({
plugins: [pacyDevtools({ bundler: 'esbuild', dev: () => true })],
});
rspack.config.js
import pacyDevtools from '@pacy-dev/plugin-devtools';
module.exports = {
plugins: [
pacyDevtools({
bundler: 'rspack',
}),
// other plugins...
],
};
rsbuild.config.js
import pacyDevtools from '@pacy-dev/plugin-devtools';
module.exports = {
// other config...
tools: {
rspack: {
plugins: [
pacyDevtools({
bundler: 'rspack',
}),
],
},
},
};
vue.config.js
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 :

nuxt.config.js
import { pacyDevtools } from '@pacy-dev/plugin-devtools';
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
vite: {
plugins: [pacyDevtools({ bundler: 'vite' })],
},
});

For nuxt2.x :

nuxt.config.js
import { pacyDevtools } from '@pacy-dev/plugin-devtools';
export default {
build: {
extend(config) {
config.plugins.push(pacyDevtools({ bundler: 'webpack' }));
return config;
},
},
};
astro.config.mjs
import { defineConfig } from 'astro/config';
import { pacyDevtools } from '@pacy-dev/plugin-devtools';
export default defineConfig({
vite: {
plugins: [pacyDevtools({ bundler: 'vite' })],
},
});

@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'