# ES6 - HSVtoRGBToRef Uncaught TypeError

**URL:** <https://forum.babylonjs.com/t/es6-hsvtorgbtoref-uncaught-typeerror/4494>\
**Category:** Bugs\
**Created:** [July 14, 2019, 1:39pm UTC](https://forum.babylonjs.com/t/es6-hsvtorgbtoref-uncaught-typeerror/4494 "2019-07-14T13:39:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vedrrran](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vedrrran/32/3578_2.png) [@vedrrran](https://forum.babylonjs.com/u/vedrrran)\
**Post date:** [July 14, 2019, 1:39pm UTC](https://forum.babylonjs.com/t/es6-hsvtorgbtoref-uncaught-typeerror/4494/1 "2019-07-14T13:39:57Z")

</div>

Using `HSVtoRGBToRef` in ES6 project causes `Uncaught TypeError`.  
Can someone explain what might be the cause?

Test code:

```auto
import * as BABYLON from '@babylonjs/core/Legacy/legacy';

let scc = new BABYLON.Color3(0.2, 0.2, 0.2);
BABYLON.Color3.HSVtoRGBToRef(0, 0, 0, scc);

```

Error:  
Uncaught TypeError: _babylonjs\_core\_Legacy\_legacy\_\_WEBPACK\_IMPORTED\_MODULE\_0_\_.Color3.HSVtoRGBToRef is not a function

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [July 15, 2019, 5:17pm UTC](https://forum.babylonjs.com/t/es6-hsvtorgbtoref-uncaught-typeerror/4494/2 "2019-07-15T17:17:05Z")

</div>

pinging our module masterchief @sebavan

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 15, 2019, 5:37pm UTC](https://forum.babylonjs.com/t/es6-hsvtorgbtoref-uncaught-typeerror/4494/3 "2019-07-15T17:37:46Z")

</div>

w0000t sounds pretty weird indeed, I will try that ASAP and let you know.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 15, 2019, 5:50pm UTC](https://forum.babylonjs.com/t/es6-hsvtorgbtoref-uncaught-typeerror/4494/4 "2019-07-15T17:50:26Z")

</div>

Just tried

```auto
import * as BABYLON from '@babylonjs/core/Legacy/legacy';
var scc = new BABYLON.Color3(0.2, 0.2, 0.2);
BABYLON.Color3.HSVtoRGBToRef(0, 0, 0, scc);
console.log(scc);

```

and it works without issue:

What version of @babylonjs/core do you use ? could you try the latest @preview ???

---

<div class="post-metadata">

**Author:** ![vedrrran](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vedrrran/32/3578_2.png) [@vedrrran](https://forum.babylonjs.com/u/vedrrran)\
**Post date:** [July 15, 2019, 7:34pm UTC](https://forum.babylonjs.com/t/es6-hsvtorgbtoref-uncaught-typeerror/4494/5 "2019-07-15T19:34:37Z")

</div>

Hi @sebavan !  
How can I get the latest version?

This is my package.json:

```auto
{
  "name": "babylonjs-webpack-boilerplate",
  "version": "1.0.0",
  "description": "This is a BabylonJS + Webpack boilerplate to work with typescript and/or es6",
  "main": "index.js",
  "scripts": {
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
    "dev": "webpack-dev-server --config ./webpack.config.js --open --mode development",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Paul Orac",
  "license": "MIT",
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.4",
    "babel-preset-env": "^1.6.1",
    "compression-webpack-plugin": "^1.1.11",
    "cross-env": "^5.1.4",
    "css-loader": "^0.28.11",
    "html-webpack-plugin": "^3.2.0",
    "style-loader": "^0.21.0",
    "ts-loader": "^4.2.0",
    "typescript": "^2.8.3",
    "uglifyjs-webpack-plugin": "^1.2.5",
    "webpack": "^4.6.0",
    "webpack-cli": "^2.0.15",
    "webpack-dev-server": "^3.1.3",
    "webpack-livereload-plugin": "^2.1.1"
  },
  "dependencies": {
    "@babylonjs/core": "^4.0.3",
    "@babylonjs/gui": "^4.0.3",
    "@babylonjs/inspector": "^4.0.3",
    "@babylonjs/loaders": "^4.0.3",
    "@babylonjs/materials": "^4.0.3",
    "@babylonjs/post-processes": "^4.0.3",
    "@babylonjs/procedural-textures": "^4.0.3",
    "@babylonjs/serializers": "^4.0.3"
  }
}

```

And this is my webpack.config.js

```auto
let webpack = require('webpack');
let HtmlWebpackPlugin = require('html-webpack-plugin');
let LiveReloadPlugin = require('webpack-livereload-plugin');
const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname,'dist'),
    filename: 'bundle.js'
  },
  resolve: {
    modules: [path.resolve(__dirname, '/src'), 'node_modules/'],
    descriptionFiles: ['package.json'],
    extensions : ['.js', '.ts', '.tsx']
  },
  module: {
    rules: [
      {
        use: 'babel-loader',
        test: /\.js$/,
        exclude: /node_modules/
      },
      {
        use: 'ts-loader',
        test: /\.tsx?$/,
        exclude: /node_modules/
      },
      {
        use: ['style-loader', 'css-loader'],
        test: /\.css$/
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: 'index.html'
    }),
    new LiveReloadPlugin()
  ],
  externals: {
    oimo: 'OIMO', //or true
    cannon: 'CANNON', //or true
    earcut: 'EARCUT'
  }
};

const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
var CompressionWebpackPlugin = require('compression-webpack-plugin');

if (process.env.NODE_ENV === 'production') {
  module.exports.devtool = '#source-map';
  module.exports.plugins = (module.exports.plugins || []).concat([
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: '"production"'
      }
    }),

    new UglifyJsPlugin({
      sourceMap: true
    }),

    new CompressionWebpackPlugin({
      asset: '[path].gz[query]',
      algorithm: 'gzip',
      test: /\.(js|ts|vue|json|png|jpg|gif|svg)$/,
      threshold: 10240,
      minRatio: 0.8
    }),

    new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
    
    new webpack.LoaderOptionsPlugin({
      minimize: true
    })
  ]);
}

```

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 15, 2019, 8:11pm UTC](https://forum.babylonjs.com/t/es6-hsvtorgbtoref-uncaught-typeerror/4494/6 "2019-07-15T20:11:06Z")

</div>

install @babylonjs/core@preview and the same for all the dependencies

One piece of advice as well could you try to rename import \* as BABYLON… to import \* as MYBABYLON to prevent some possible conflicts with the BABYLON global just to be safe ?

---

<div class="post-metadata">

**Author:** ![vedrrran](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vedrrran/32/3578_2.png) [@vedrrran](https://forum.babylonjs.com/u/vedrrran)\
**Post date:** [July 17, 2019, 5:04pm UTC](https://forum.babylonjs.com/t/es6-hsvtorgbtoref-uncaught-typeerror/4494/7 "2019-07-17T17:04:51Z")

</div>

Hi @sebavan !  
I can confirm that `@babylonjs/core@preview` works without `Uncaught TypeError`.
