martonlederer / esbuild-plugin-postcss2

Use postcss with esbuild
MIT License
33 stars 19 forks source link

postCssPlugin is not a function #24

Closed jameshfisher closed 2 years ago

jameshfisher commented 2 years ago

All the examples in the README seem broken:

const postCssPlugin = require("esbuild-plugin-postcss2");
// ...
    postCssPlugin()
// ...
$ node
Welcome to Node.js v14.17.6.
Type ".help" for more information.
> const postCssPlugin = require("esbuild-plugin-postcss2");
undefined
> postCssPlugin()
Uncaught TypeError: postCssPlugin is not a function
> typeof postCssPlugin
'object'
> postCssPlugin
{ default: [Getter] }
>

(This is with "esbuild-plugin-postcss2": "^0.1.0")

jameshfisher commented 2 years ago

It seems the actual API is

const postCssPlugin = require("esbuild-plugin-postcss2");
// or
import postCssPlugin from "esbuild-plugin-postcss2";

// ...
    postCssPlugin.default({ plugins: [ ... ] })
// ...
alaadahmed commented 2 years ago

The same issue I have