dorukeker / gyronorm.js

JavaScript project for accessing and normalizing the accelerometer and gyroscope data on mobile devices
MIT License
641 stars 65 forks source link

Usage with webpack #27

Closed GabrielGil closed 7 years ago

GabrielGil commented 7 years ago

Hello!

I am trying to use this library with webpack (ES6 import) however, something seems to be missing as the file imported is the main one specified in package.json which seems to not have all the needed dependencies.

Is any work on progress about this? Something I might help on?

Thank you!

dorukeker commented 7 years ago

Hello Gabriel, I am not very knowledgeable about the ES6 imports. And there is no current work on this. So if you can fix and send a PR I'd be more than glad to merge. :)

Cheers, Doruk

GabrielGil commented 7 years ago

alright, I understand. I am currently experimenting with the library and it seems the major of the problems are the libraries.

I will be working on this definitely, so I would appreciate to keep this issue open because I am planning to send a PR at some point soon.

Thank you!

dorukeker commented 7 years ago

Super. I will keep it open. Cheers!

dorukeker commented 7 years ago

Hi there. I just merged a PR. It should have solved this issue. Can you check and let me know?

GabrielGil commented 7 years ago

Hi! Thank you for ping me on this. I have just tried it out on 2.0.5 and it seems that still not working right.

I have checked the PR as well, and that solutions seems not valid to me. I believe the error is in the export around this line.

The error I am getting is:

Uncaught TypeError: Cannot set property 'GyroNorm' of undefined
GabrielGil commented 7 years ago

I made it work with AMD and CommonJS finally. 😄

I will make a PR tomorrow after some testing. I hope it helps, and thank you again for your attention.

botraunak commented 6 years ago

Still facing this issue. what version should we be getting where this would be solved? i'm using "gyronorm": "^2.0.6",

GabrielGil commented 6 years ago

Yes, I can confirm at version 2.0.6 the imports work just fine:

// ES6+
import Gyronorm from 'gyronorm';
// Typescript
let Gyronorm = require('gyronorm');
let gs = new Gyronorm();
console.log('Gyronorm instance', gs);
botraunak commented 6 years ago

@GabrielGil Thanks for the reply. npm was fetching 2.0.4 for unknown reasons. Related: https://github.com/dorukeker/gyronorm.js/issues/40#issuecomment-308603450