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

'ReferenceError: assignment to undeclared variable Leap', when using Webpack #25

Open
tobiasvandriessel opened this issue Feb 25, 2019 · 0 comments

Comments

@tobiasvandriessel
Copy link

When importing aframe and aframe-leap-hands, I think somehow the latter isn't loaded before the a-scene is created, because it results in the following error: 'ReferenceError: assignment to undeclared variable Leap'. Maybe the fact that the main.js file is loaded in the body is the culprit here?

Would you perhaps know what the issue could be here?

webpack.config.js:

const path = require('path');

module.exports = { 
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist')
  },
  devServer: {
    contentBase: './dist'
  }
};

src/index.js:

import aframe from 'aframe';
import 'aframe-leap-hands';

And finally, the adjusted code from your example leap-hands.
dist/index.html:

<!doctype html>
  <html>
   <head>
    	<title>Getting Started</title>
   </head>
   <body>
   	<script src="main.js"></script>

<a-scene>
      <!-- Player -->
      <a-entity camera="near: 0.01" look-controls>
        <a-entity leap-hand="hand: left"></a-entity>
        <a-entity leap-hand="hand: right"></a-entity>
      </a-entity>

      <!-- Terrain -->
      <a-grid></a-grid>

      <!-- Lighting -->
      <a-light type="ambient" color="#ccc"></a-light>
      <a-light color="#ddf" distance="100" intensity="0.4" type="point"></a-light>
      <a-light color="#ddf" position="3 10 -10" distance="50" intensity="0.4" type="point"></a-light>
    </a-scene>


   </body>
  </html>
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

1 participant