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

Unable to use via import/require #4

Open
notchris opened this issue Mar 25, 2019 · 4 comments
Open

Unable to use via import/require #4

notchris opened this issue Mar 25, 2019 · 4 comments

Comments

@notchris
Copy link

Hello, I've installed the plugin using: yarn add matter-collision-events.

Then I attempt to require/import the plugin, however Matter does not seem to recognize the plugin when imported.

I've tried the following:

import * as Matter from 'matter-js' import MatterCollision from 'matter-collision-events' Matter.use('matter-collision-events')

import * as Matter from 'matter-js' import MatterCollision from 'matter-collision-events' Matter.use(MatterCollision)

I've also tried importing as 'MatterCollisionEvents'.

I get the same error:

Plugin.dependencies: matter-collision-events used by matter-js@0.14.2 could not be resolved.

Let me know if I'm doing something wrong, thanks!

  • Chris
@notchris
Copy link
Author

Screenshot of console for reference: https://i.imgur.com/RL3hH1K.png

@getkey
Copy link

getkey commented Apr 26, 2019

You need to import Matter.js as the default export, not with a *.

import Matter from 'matter-js';
import { MatterCollisionEvents } from 'matter-collision-events';

Matter.use(MatterCollisionEvents);

@marwan38
Copy link

marwan38 commented Jun 2, 2019

import { MatterCollisionEvents } from 'matter-collision-events';

Worked for me - thanks!

@notchris
Copy link
Author

notchris commented Jun 2, 2019

Also worked for me, thank you.

matyus added a commit to matyus/matter-collision-events that referenced this issue Feb 16, 2020
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

3 participants