Answer the question
In order to leave comments, you need to log in
Why is Gulp + Babelify not compiling correctly?
gulpfile.js:
const gulp = require('gulp');
const babel = require('gulp-babel');
const watch = require('gulp-watch');
const rename = require("gulp-rename");
const browserify = require('gulp-browserify');
const babelify = require("babelify");
gulp.task('js', () => {
gulp.src('public/js/dev/app.js')
.pipe(browserify({
transform: ['babelify'],
}))
.pipe(gulp.dest('./public/js'))
});
gulp.task('watch:js', () => {
gulp.watch(['public/js/dev/app.js','public/js/modules/*.js'], ['js']);
});
//...
var Map = require('../modules/map.js');
var map = new Map('map',[43.2317986,44.749744]);
class Map
{
constructor(id,arr) {
this.map_id = id;
this.latlong = arr;
this.map = null;
const tinyIcon = L.Icon.extend({
options: {
iconSize: [32, 32],
iconAnchor: [12, 36],
popupAnchor: [0, -30]
}
});
const me = new tinyIcon({ iconUrl: 'https://cdn3.iconfinder.com/data/icons/iconka-buddy-set/128/male_dummy_128.png' });
const guest = new tinyIcon({ iconUrl: 'https://cdn3.iconfinder.com/data/icons/iconka-buddy-set/128/ninja_128.png' });
getLatLong => ( () => {
console.log('asd');
})
// this.map = L.map(this.map_id).setView([latlong[0], latlong[1]], 12);
//
// L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(this.map);
//
// const userMarker = L.marker([56.326944, 44.0075], {
// icon: redIcon
// });
}
setMarker(){
return 0;
}
getLatLong(callback){
navigator.geolocation.getCurrentPosition(position => {
callback(position);
});
}
}
app.js:4 Uncaught TypeError: Map is not a constructor
Answer the question
In order to leave comments, you need to log in
In modules/map.js do you have an export of the Map class?
ormodule.exports = Map;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question