tsparticles / tsparticles

tsParticles - Easily create highly customizable JavaScript particles effects, confetti explosions and fireworks animations and use them as animated backgrounds for your website. Ready to use components available for React.js, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno, Solid, Riot and Web Components.
https://particles.js.org
MIT License
7.18k stars 798 forks source link

Issue : Need an appropriate loader to handle file type #5340

Closed testtwf closed 1 month ago

testtwf commented 1 month ago

Contact Details

testtwf@gmail.com

What do you need?

First of all, thanks for the great library. i'm trying to install the package using npm in my machine but it is throwing below error. i'm mentioning the other info as well.

config details

dependencies version used-

"sass": "^1.15.2",
  "sass-loader": "^7.1.0",
  "vue": "^2.5.17",
  "vue-template-compiler": "^2.6.10",
  "@tsparticles/engine": "^3.3.0",
  node version : v20.12.1
  npm version : 10.5.0
  //webpack(laravel mix) config
  const mix = require('laravel-mix');

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .setResourceRoot('../');

if (mix.inProduction()) {
    mix.version();
}

Error

 error  in ./node_modules/@tsparticles/engine/browser/Utils/ColorUtils.js

Module parse failed: Unexpected token (102:31)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
| export function stringToAlpha(input) {
>     return stringToRgba(input)?.a;
| }
| export function stringToRgb(input) {}
Module parse failed: Unexpected token (10:35)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
| export function paintBase(context, dimension, baseColor) {
>     context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|     context.fillRect(origin.x, origin.y, dimension.width, dimension.height);
| }

Kindly let me know, how to fix it and what loader i need to use to fix the issue.

tsParticles Version

^3.3.0

Code of Conduct

matteobruni commented 1 month ago

Maybe you should ask this in the webpack repository or whatever tool you are using to bundle your project. It's not a problem of this library. It's hard to say what is the missing loader, without more informations, but it's unrelated to this project.