windicss / windicss-webpack-plugin

🍃 Windi CSS for webpack ⚡
https://windicss.org/integrations/webpack.html
79 stars 19 forks source link

[webpack-cli] Promise rejection: TypeError: WindiCSS is not a constructor #84

Closed lautiamkok closed 3 years ago

lautiamkok commented 3 years ago

Following the installation guide here https://windicss.org/integrations/webpack.html for webpack, I get the following error:

[webpack-cli] Promise rejection: TypeError: WindiCSS is not a constructor
[webpack-cli] TypeError: WindiCSS is not a constructor
    at Object.<anonymous> (/home/webpack-5/webpack.common.js:237:5)
    at Module._compile (/home/webpack-5/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (/home/webpack-5/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/home/webpack-5/webpack.development.js:2:16)
    at Module._compile (/home/webpack-5/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (/home/webpack-5/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/home/webpack-5/webpack.config.js:1:89)
    at Module._compile (/home/webpack-5/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)

Why?

I am using webpack 5.

KiryaAfimin commented 3 years ago

const WindiCSS = require('windicss-webpack-plugin').default;

harlan-zw commented 3 years ago

@lautiamkok This package acts as a bridge for the first-class support frameworks, such as Nuxt & Vue CLI.

When using it for something custom outside of these there are far too many edge cases for me to predict and the only way I fix issues for your specific issues, if if you make an issue for them.

This is open-source, if you're going to provide feedback, make it constructive. If you don't like the package then use something else.

I have updated the docs to make the usage of the require syntax more obvious