-
Notifications
You must be signed in to change notification settings - Fork 206
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
this.projectionMatrix.fromPerspective is not a function #18
Comments
Hey mate, The Mat4 class (and each Math class) extends Array, so I'm assuming the issue is something to do with that. What pipeline steps are you using? Are you able to check each step's output to see where the issue starts? For the import when using npm, you can do that, absolutely! |
What do you mean by pipeline? With a simple html file with a I just tried using npm and I have the error |
By pipeline I mean the build steps to generate the final js code that runs in the browser. The import/export error also sounds like a pipeline issue. |
Oh, sure. I use gulp, and this is the task for JavaScript files. If you see something that looks wrong... import gulp from 'gulp'
import watch from 'gulp-watch'
import vinyl from 'vinyl-source-stream'
import browserify from 'browserify'
import watchify from 'watchify'
import aliasify from 'aliasify'
import envify from 'envify/custom'
import pckg from '../../package.json'
import project from '../../project.json'
import opts from '../options'
import time from '../utils/time-elapsed'
import onError from '../utils/on-error'
import globify from 'require-globify';
import folderify from 'folderify';
import glslify from 'glslify';
import jstfy from 'jstify';
const timeElapsed = time('js')
gulp.task('scripts', function() {
let bundler = browserify({
entries: 'src/index.js',
cache: {},
packageCache: {},
fullPaths: opts.debug,
debug: opts.debug,
insertglobals: true // for globals like FB, YT...
})
if (opts.watch) {
bundler = watchify(bundler)
bundler.on('update', bundle)
watch(['package.json'], bundle) // Rebuild if changing stuff in package.json (like environments)
// watch(['src/svg/**/*.svg'], bundle)
}
applyTransform(bundler)
return bundle()
function bundle() {
timeElapsed.start()
return bundler.bundle()
.on('error', onError)
.pipe(vinyl('main.js'))
.pipe(gulp.dest('static/build'))
.on('end', timeElapsed.end)
}
})
function applyTransform(bundler) {
/*
Pass some flags to the build
if (App.ENV === 'dev') { ... do something in dev mode ... }
if (App.ENV === 'live') { ... do something in live mode ... }
Any variable in project.json will be added here
*/
const paths = project.env[opts.env]
bundler.transform('babelify', {
presets: ['es2015'],
plugins: ['transform-decorators-legacy']
})
bundler.transform(globify)
bundler.transform(folderify)
bundler.transform(jstfy)
bundler.transform(glslify)
bundler.transform(aliasify, pckg.aliasify)
bundler.transform(envify({
ENV: opts.env,
paths: paths
}))
} |
I haven't used browserify, but searching quickly (browserify/browserify#1186) it look like it might not support es6 module syntax yet? I see a couple comments about waiting until Node also supports it. |
It looks like good old Matt DesLauriers has already written a solution to add support! https://github.com/mattdesl/esmify |
That is weird, because I use import and export on all my files. Thanks for searching on it! Merci! |
Hi Nathan,
I wanted to try the module on a site with browserify. I'm seeing some errors that don't show up on your demos. It seems that projectionMatrix from the Camera component is just an array instead of being a Mat4.
Do you have any ideas why it wouldn't work on a build file? Also, I had to download the repository and load it in a folder of my site instead of node_modules.
On your demos, you import the files with relative paths:
Could I do this using npm instead? Something like this...
Thank you, it's amazing work!
The text was updated successfully, but these errors were encountered: