Skip to content

Latest commit

 

History

History
108 lines (80 loc) · 1.57 KB

README.md

File metadata and controls

108 lines (80 loc) · 1.57 KB

unplugin-inject-js-snippet

Support for injecting js snippet into html and js files.

Starter template for unplugin.

Install

npm i unplugin-inject-js-snippet
Vite
// vite.config.ts
import Starter from 'unplugin-inject-js-snippet/vite'

export default defineConfig({
  plugins: [
    Starter({ /* options */ }),
  ],
})

Example: playground/


Rollup
// rollup.config.js
import Starter from 'unplugin-inject-js-snippet/rollup'

export default {
  plugins: [
    Starter({ /* options */ }),
  ],
}


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-inject-js-snippet/webpack')({ /* options */ })
  ]
}


Nuxt
// nuxt.config.js
export default {
  buildModules: [
    ['unplugin-inject-js-snippet/nuxt', { /* options */ }],
  ],
}

This module works for both Nuxt 2 and Nuxt Vite


Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-inject-js-snippet/webpack')({ /* options */ }),
    ],
  },
}


esbuild
// esbuild.config.js
import { build } from 'esbuild'
import Starter from 'unplugin-inject-js-snippet/esbuild'

build({
  plugins: [Starter()],
})