Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use particles.js in webpack by installing with npm

I installed particles.js with: npm particles.js --save

Error: bundle.js:54 GET http://localhost:8080/particles.json 404 (Not Found)

I have tried different paths but it doesn't seem to work.

In the file app.js:

import 'particles.js/particles';
const particlesJS = window.particlesJS;
particlesJS.load('particles-js', 'particles.json', null);

Folderstructure:
- index.html
- src/js/app.js
- src/js/particles.json

like image 206
EnzoTrompeneers Avatar asked Jan 25 '26 23:01

EnzoTrompeneers


1 Answers

try this:

import "particles.js";

particlesJS.load('container', 'particles.json', function () {
  console.log('loaded');
});
like image 172
Toshio Minei Avatar answered Jan 27 '26 13:01

Toshio Minei