Package Exports
- @builder.io/dev-tools/core
- @builder.io/dev-tools/next
- @builder.io/dev-tools/node
- @builder.io/dev-tools/server
- @builder.io/dev-tools/vite
- @builder.io/dev-tools/webpack
Readme
Builder.io Visual CMS Dev Tools
Setup and integrate Builder.io Visual CMS during development using the Dev Tools plugin. Builder Dev Tools can be integrated with a project's development through either a Next.js config, Vite plugin, or Webpack plugin.
Installing Builder Dev Tools
Builder's Dev tools can be installed and initialized using:
npm init @builder.io@latest
This command will update the config file (such as next.config.js, or vite.config.js) and install the @builder.io/dev-tools
package. Once installed, you can start your app's dev server:
npm run dev
Manual Installation
Alternatively, you can manually install Builder's Dev Tools, and update the config files following the steps below.
npm install -D @builder.io/dev-tools
Next step is to add the Dev Tools plugin to your build tool's config file. For example, if you're using Next.js, see the docs below on how to import and add Dev Tools to a Next.js app.
Next.js
A utility function is provided to update your next config in order to run Dev Tools during development. Wrap your existing next config using the withBuilderDevTools()
function that's created when it is required at the top of the config.
// next config file
const withBuilderDevTools = require("@builder.io/dev-tools/next")({
// Builder Dev Tools Options
});
module.exports = withBuilderDevTools({
// next config
});
Or configuration as a function:
module.exports = (phase, defaultConfig) => {
return withBuilderDevTools(defaultConfig);
};
Vite
The Vite plugin for Dev Tools is meant for frameworks using Vite for its development. Currently, Dev Tools supports Qwik integrated with Vite. Import builderDevTools
from @builder.io/dev-tools/vite
and place it as the the first plugin to ensure it runs before others.
// vite config file
import { defineConfig } from "vite";
import { builderDevTools } from "@builder.io/dev-tools/vite";
export default defineConfig(() => {
return {
plugins: [builderDevTools()],
};
});
Webpack
The Dev Tools webpack plugin is for React projects. If your project is using Next.js, please see the Next.js docs above on how to add the Dev Tools plugin to the next config. Below is a general webpack config for a React project.
// webpack config file
const { BuilderDevToolsPlugin } = require("@builder.io/dev-tools/webpack");
module.exports = {
plugins: [new BuilderDevToolsPlugin()],
};