vite-plugin-inject-css-bundle
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

vite-plugin-inject-css-bundle

Import css bundle in-place in Vite lib mode.

Note that this plugin only works in conjunction with vite cssCodeSplit option.

Build Status Code Coverage Issues Open Licenses Bundle Size NPM

Getting started

Install package

npm install -D vite-plugin-inject-css-bundle
yarn add -D vite-plugin-inject-css-bundle
pnpm add -D vite-plugin-inject-css-bundle

Add plugin to vite.config

// vite.config.ts
import injectCss from 'vite-plugin-inject-css-bundle'

export default defineConfig({
  plugins: [
    ...,
    injectCss(),
  ],
  ...
})

How it works

The plugin will then ensure any modular css, with the .module.css extension will automatically be injected into the output javascript, using the correct import statement.

import styles from './component.module.css'

↓↓↓

...
import './__assets__/component-13fa45.css'

Package Sidebar

Install

npm i vite-plugin-inject-css-bundle

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

11.5 kB

Total Files

8

Last publish

Collaborators

  • blissful89