Giter Site home page Giter Site logo

Comments (5)

marcofugaro avatar marcofugaro commented on May 23, 2024 1

Thanks for the issue! Haven't tried SparkAR myself, could you maybe share a minimal reproducible project with cannon-es? It will help with debugging.
That error is kinda weird, will check if it's something we added in cannon-es.

from cannon-es.

marcofugaro avatar marcofugaro commented on May 23, 2024 1

I've found the issue, you can't use npm modules directly from SparkAR, you have to add them as scripts:

Screenshot 2021-12-28 at 16 14 58

For cannon-es specifically, you have to use the dist/cannon.cjs.js file, and import it as

import * as CANNON from './cannon-es'

I've made an example starter project with cannon-es already installed:

cannon-es_working.arprojpkg.zip

from cannon-es.

johannesrave avatar johannesrave commented on May 23, 2024

Thanks a lot for your quick reply!
I attached a zipped "cannon-es_debuggingProject.arprojpkg", that's the packaged format for SparkAR-Studio projects. If you open it with SparkAR, it'll already do what this issue is about (on my system, anyway). If you want to play around with it, "save as" and it'll extract to a project directory where you point it to. That'll have the "scripts" subdir, where the .ts and the node_modules are etc.

The script is basically blank:

import D from 'Diagnostics';
import CANNON from 'cannon-es';

(async function () {
    D.log("Init cannon-es_Hook");

    const body = new CANNON.Body();
})();

It won't even print the log, as the error is thrown during compilation. With this empty-ish project, the line number is only "856".

image

I guess finding the (bundled?) JS that SparkAR is trying to compile could help in finding out more. If you yarn add cannon and adjust the import, the log is printed to the SparkAR console. Let me know if you need anything else :)

cannon-es_debuggingProject.zip

from cannon-es.

nicolashahn avatar nicolashahn commented on May 23, 2024

@johannesrave did you ever sort this out? Seeing something similar in Studio, though I'm not using cannon.js

from cannon-es.

johannesrave avatar johannesrave commented on May 23, 2024

very cool, thank you @marcofugaro !

from cannon-es.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.