Node-vibrant: this.WorkerClass is not a constructor

Created on 29 Jan 2019  ·  15Comments  ·  Source: Vibrant-Colors/node-vibrant

Hi, I am getting this error with the example from the docs:

in promise) TypeError: this.WorkerClass is not a constructor.

This is my code:

console.log(src); Vibrant.from(src).getPalette() .then((palette) => console.log(palette))

I am using React.

Most helpful comment

@ivgtr Your solution worked perfectly to resolve this issue!

npm remove node-vibrant && npm install [email protected]

All 15 comments

I'm also getting the exact same error when trying to implement the example in React, please help.

Sorry for the confusion. We are still finalizing the docs.

You will need webpack and worker-loader for this to work.
Relevant docs are in the develop branch:
https://github.com/akfish/node-vibrant/tree/develop#webpack-configuration

I'll do my best to take a look at how we can ship down a built version of this that doesn't require webpack. Timeline is hesitant, as I have some family health problems, so please be patient :)

Same problem, using vue.js though

Same problem, using Angular 7 :)

Same problem with Vue.js
Using Webpack

@AggressivelyMeows, @MadReal make sure you have worker-loader installed and change webpack configuration. In case of using Vue, you need to edit vue.config.js.

//vue.config.js
module.exports = {
  configureWebpack: {
    module: {
      rules: [
        {
          test: /\.worker\.js$/,
          use: { loader: "worker-loader" }
        }
      ]
    }
  },
}

Hi. Can't find a may to make it work. I have the loader in my webpack config but still have the error...

@akfish any ideas ?

Please avoid tagging maintainers directly - FWIW I'm one the current maintainer of the project.

Is there any way someone could provide a minimal reproduction that I can take a look into? I'm not able to reproduce

Currently, npmjs has an alpha version distributed as a latest version.
In my case(use Nuxt.js), I downgraded from "3.2.1-alpha.1" to "3.1.6", and the error was solved.

@ivgtr Your solution worked perfectly to resolve this issue!

npm remove node-vibrant && npm install [email protected]

@ivgtr solved! thanks!
added config from docs and downgraded to [email protected]
Hope this issue will be solved in next versions of node-vibrant
Using React and ejected react-create-app

please not make like https://github.com/storybookjs/storybook/issues , as you see there is more issue for webpack crap config than "true" issue of the main functionnality.

Make usage easiest possible please.

@ivgtr Your solution worked perfectly to resolve this issue!

npm remove node-vibrant && npm install [email protected]

thank you!!!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daviestar picture daviestar  ·  9Comments

inbarshani picture inbarshani  ·  4Comments

lucafaggianelli picture lucafaggianelli  ·  9Comments

chetstone picture chetstone  ·  14Comments

amirping picture amirping  ·  6Comments