GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • magic-regexp
  • Setup

This view

  • Original page
  • New address

GeezerVison is showing regexp.dev — Setup

Setup

Install magic-regexp from npm and (optionally) enable the build-time transform via a plugin.

First, install magic-regexp:

npm
pnpm
bun
yarn
npm i magic-regexp
pnpm i magic-regexp
bun add magic-regexp
yarn add magic-regexp

Second, optionally, you can enable the included transform, which enables zero-runtime usage.

nuxt.config.ts
vite.config.ts
next.config.mjs
build.config.ts
// Nuxt 3
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
  // This will also enable auto-imports of magic-regexp helpers
  modules: ['magic-regexp/nuxt'],
})
import { MagicRegExpTransformPlugin } from 'magic-regexp/transform'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [MagicRegExpTransformPlugin.vite()],
})
// or, if using next.config.js
// const { MagicRegExpTransformPlugin } = require('magic-regexp/transform')
import { MagicRegExpTransformPlugin } from 'magic-regexp/transform'

export default {
  webpack(config) {
    config.plugins = config.plugins || []
    config.plugins.push(MagicRegExpTransformPlugin.webpack())
    return config
  },
}
import { MagicRegExpTransformPlugin } from 'magic-regexp/transform'
// unbuild
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
  hooks: {
    'rollup:options': (options, config) => {
      config.plugins.push(MagicRegExpTransformPlugin.rollup())
    },
  },
})
Usage
Star on GitHub Create Issues
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.