tsparticles: [Bug]: `exports is not defined` with out-of-the-box Svelte project

Contact Details

nguyen.long.908132@gmail.com

What happened?

Following the readme for svelte-particles, loading the site results in an exports is not defined error, even with a fresh project skeleton. Rollup is also complaining about circular dependencies, so it might be the source of the problem. Using https://github.com/sveltejs/template/commit/8d350b693fb4bd8ecf340841eac22a1cb85d7986.

Version

1.40.1

Which library are you using?

Svelte (svelte-particles)

tsParticles Configuration

none needed, it throws immediately on loading the module

What browsers are you seeing the problem on?

Microsoft Edge

Relevant log output

(!) Circular dependencies
node_modules\tsparticles\Core\index.js -> node_modules\tsparticles\Core\Canvas.js -> node_modules\tsparticles\Utils\index.js -> node_modules\tsparticles\Utils\CanvasUtils.js -> node_modules\tsparticles\Utils\ColorUtils.js -> node_modules\tsparticles\Utils\NumberUtils.js -> node_modules\tsparticles\Core\index.js
node_modules\tsparticles\Core\index.js -> node_modules\tsparticles\Core\Canvas.js -> node_modules\tsparticles\Utils\index.js -> node_modules\tsparticles\Utils\CanvasUtils.js -> node_modules\tsparticles\Utils\ColorUtils.js -> node_modules\tsparticles\Utils\NumberUtils.js -> G:\Code\tsParticles test\node_modules\tsparticles\Core\index.js?commonjs-proxy -> node_modules\tsparticles\Core\index.js
node_modules\tsparticles\Core\index.js -> node_modules\tsparticles\Core\Canvas.js -> node_modules\tsparticles\Utils\index.js -> node_modules\tsparticles\Utils\CanvasUtils.js -> node_modules\tsparticles\Utils\ColorUtils.js -> node_modules\tsparticles\Core\index.js
node_modules\tsparticles\Core\index.js -> node_modules\tsparticles\Core\Canvas.js -> node_modules\tsparticles\Utils\index.js -> node_modules\tsparticles\Utils\CanvasUtils.js -> node_modules\tsparticles\Utils\ColorUtils.js -> node_modules\tsparticles\Utils\Utils.js -> node_modules\tsparticles\Core\index.js

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

It’s working, also when using the package without yarn link, I’ve created the package and installed using the file path to the zipped file, and the svelte demo created with these instructions is working. I’m going to release an update soon so we can see if this issue is solved.

I’m trying a build without it, let’s see if everything work without it

I’ve tested your steps and the error showed up. There are no big differences between the demo project (visible here) and that works.

So I tried replacing npm with yarn, and linking this new demo to the locally built versions, and it started working. That’s why my local version works (the monorepo links packages).

This is a really annoying issue 😅

What I’ve seen, the script taken is the one with commonjs instead of the esm or umd. I need to do more output files tests.

I never used SvelteKit, but I’ll investigate the error later, following your steps