Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 645 Bytes

File metadata and controls

32 lines (23 loc) · 645 Bytes

esbuild-plugin-native-css-module

Resolve import ... with { type: css } as instance of CSSStyleSheet in esbuild. If css file linked via <link rel="stylesheet" href="..."> it will be bundled using css loader.

Install

npm i -D esbuild-plugin-native-css-module

Usage

import { build } from 'esbuild'
import nativeCSSModule from 'esbuild-plugin-native-css-module'

build({
  entryPoints: ['src/index.js'],
  bundle: true,
  outfile: 'dist/index.js',
  plugins: [nativeCSSModule()]
})

Example

import style from './style.css' with { type: css }

console.log(style instanceof CSSStyleSheet) // true