esbuild-styla-plugin

raw JSON →
0.0.10 verified Fri May 01 auth: no javascript

An esbuild plugin for processing Stylus (.styl) files. Version 0.0.10 is the latest and appears to be stable with maintenance ongoing. It integrates Stylus compilation into esbuild builds, allowing custom imports and typical Stylus options. Unlike standalone Stylus CLI or webpack loaders, this plugin provides native esbuild integration. It is a niche plugin with limited adoption but serves its purpose for Stylus users on esbuild. No major breaking changes have been documented.

error Cannot find module 'esbuild-styla-plugin'
cause Package not installed or typo in package.json.
fix
Run 'npm install esbuild-styla-plugin' and verify dependency.
error TypeError: stylaPlugin is not a function
cause Using wrong import pattern (e.g., importing named export instead of default).
fix
Use default import: const stylaPlugin = require('esbuild-styla-plugin');
gotcha Plugin options not well documented - only 'imports' shown.
fix Refer to Stylus API for additional options; check source code.
breaking Potential breaking changes in minor versions due to early stage.
fix Pin version and monitor releases.
deprecated No deprecation warnings documented.
npm install esbuild-styla-plugin
yarn add esbuild-styla-plugin
pnpm add esbuild-styla-plugin

Shows how to use the plugin in an esbuild build configuration with a Stylus theme import.

const stylaPlugin = require('esbuild-styla-plugin');
esbuild.build({
  entryPoints: ['./src/index.js'],
  bundle: true,
  outfile: './dist/app/app.js',
  loader: { '.js': 'jsx' },
  sourcemap: true,
  target: ['chrome58', 'firefox57', 'safari11', 'edge16'],
  define: { 'process.env.NODE_ENV': '"development"' },
  plugins: [
    stylaPlugin({
      imports: ['./styles/theme.styl'],
    }),
  ],
});