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

Sourcemaps get wrong mapping #6

Open
pailhead opened this issue Mar 29, 2016 · 0 comments
Open

Sourcemaps get wrong mapping #6

pailhead opened this issue Mar 29, 2016 · 0 comments

Comments

@pailhead
Copy link

It took me a while to figure out that the sourcemap mapping issue i had was due to browserify-shader.

This is my gulp task:

var bundler = browserify('./www/js/app/main.js', {
    debug: true
});

if (watch) {
    bundler = watchify(bundler);
    bundler.on('update', function(){ bundle(bundler) });
    bundler.on('log', function(message){ $.util.log(message) });
}

bundler.transform(
    babelify.configure({
        sourceMapRelative: 'www/js',
        presets: ['es2015'],
        plugins: ['transform-class-properties']
    })
);

bundler.transform('browserify-shader');

bundler.bundle()
    .on('error',notifier)
    .pipe( source('main.bundle.js') )//vinyl-source-stream
    // .pipe(buffer())
    // .pipe(sourcemaps.init({loadMaps: true }))
    // .pipe( sourcemaps.write('./'))

    .pipe(gulp.dest('./www/js/'));

but then i would get this

var crossFadeMaterial = new THREE.ShaderMaterial({

uniforms:{
    uTexA:{
        type:'t',
        value:null
    },
    uTexB:{
        type:'t',
        value:null
    },
    uFade:{
        type:'f',
        value:0
    }
},
vertexShader: require('./crossFade.vert')(),
fragmentShader: require( './crossFade.frag')()

});


export default class CrossFadePlane extends THREE.Mesh {

constructor(){

    super( pg , crossFadeMaterial.clone() );
    console.log('foo',this);
}
...

browserify

Removing all calls to require('someShader') mapped everything correctly.

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