I have included the following js library in my project: Particles.js. Now in my component I import it and load it like this:
import { Component, h } from '@stencil/core';
import * as particlesJS from 'particles.js';
@Component({
tag: 'app-home',
styleUrl: 'app-home.css'
})
export class AppHome {
componentDidLoad() {
particlesJS.load('particles-js', 'assets/particlesjs-config.json', function() {
console.log('callback - particles.js config loaded');
});
}
render() {
return (
<div id="particles" class='app-home w-full h-full fixed bg-blue-200'>
</div>
);
}
}
Now the problem is when I build and run my code I get the following error:
TypeError: "undefined is not a function"
particlesJS always seems to be undefined for some reason even though I have imported it at the top.