Skip to content

fronteers/eleventy-plugin-vite

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

11ty Logo  Vite logo

eleventy-plugin-vite 🕚⚡️🎈🐀

A plugin to use Vite v4.0 with Eleventy v2.0.

This plugin:

  • Runs Vite as Middleware in Eleventy Dev Server (try with Eleventy’s --incremental)
  • Runs Vite build to postprocess your Eleventy build output

Related Projects

  • slinkity by @Holben888: a much deeper and more comprehensive integration with Vite! Offers partial hydration and can use shortcodes to render framework components in Eleventy!
  • vite-plugin-eleventy by @Snugug: uses Eleventy as Middleware in Vite (instead of the post-processing approach used here)

Eleventy Housekeeping

npm Version

Installation

npm install @11ty/eleventy-plugin-vite
const EleventyVitePlugin = require("@11ty/eleventy-plugin-vite");

module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(EleventyVitePlugin);
};

Options

View the full list of Vite Configuration options.

const EleventyVitePlugin = require("@11ty/eleventy-plugin-vite");

module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(EleventyVitePlugin, {
    tempFolderName: ".11ty-vite", // Default name of the temp folder

    // Options passed to the Eleventy Dev Server
    // e.g. domdiff, enabled, etc.
    // Added in Vite plugin v2.0.0
    serverOptions: {},

    // defaults are shown
    viteOptions: {
      clearScreen: false,
      appType: "mpa", // New in v2.0.0

      server: {
        mode: "development",
        middlewareMode: true,
      },

      build: {
        mode: "production",
      },

      // New in v2.0.0
      resolve: {
        alias: {
          // Allow references to `node_modules` folder directly
          '/node_modules': path.resolve(".", 'node_modules')
        },
      }
    }
  });
};

Limitations and TODOs

About

A plugin to use Vite with Eleventy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%