Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class constructor Element cannot be invoked without 'new' #55

Open
edemaine opened this issue Oct 18, 2021 · 3 comments
Open

Class constructor Element cannot be invoked without 'new' #55

edemaine opened this issue Oct 18, 2021 · 3 comments

Comments

@edemaine
Copy link

edemaine commented Oct 18, 2021

I'm getting the following error when trying to build a basic filter

svg.filter.js:16 Uncaught TypeError: Class constructor Element cannot be invoked without 'new'
    at new Filter (svg.filter.js:16)
    at Defs.filter (svg.filter.js:316)
    at Use.filterWith (svg.filter.js:336)

I don't understand why this error occurs, because svg.filter.js:316 clearly has a new:

var filter = this.put(new Filter())

My code:

robot.filterWith((add) =>
  add.colorMatrix('hueRotate', 0))

(robot is an SVG.Use object.)

package.json dependencies:

  "dependencies": {
    "@svgdotjs/svg.filter.js": "^3.0.7",
    "@svgdotjs/svg.js": "^3.0.16"
  }

HTML:

<script src="node_modules/@svgdotjs/svg.js/dist/svg.min.js"></script>
<script src="node_modules/@svgdotjs/svg.filter.js/dist/svg.filter.js"></script>

Am I missing something obvious?

@Fuzzyma
Copy link
Member

Fuzzyma commented Oct 18, 2021

I think the transpilation step might mess up stuff here. Maybe I have to update the toolchain and rebuild. You can try using the esm versions. That should work

@edemaine
Copy link
Author

edemaine commented Oct 18, 2021

Sounds good. As my filter needs were simple, I've switched to using .animate().during() and setting CSS filters for now, so no rush for me. But thought it might be helpful to know the situation.

@Fuzzyma
Copy link
Member

Fuzzyma commented Oct 18, 2021

I released a new version with an updated build chain. Hopefully that fixes it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants