javascript - Use laravel elixir to transpile es6 that uses "import" statements -


trying use laravel-elixir transpile code working fine jspm, following snippets, end result error in browser complaining jquery not being loaded (uncaught referenceerror: $ not defined). i'm told because browserify needs run babelify transform (or run in babelify transform mode?), not sure means, obvious first time experience these tools.

app.js

import $ 'jquery'; import pbnumberset './class/pbnumberset';  var primary = new pbnumberset('#primary_pbset'); 

gulpfile

gulp.task('default', () => {     var elixir = require('laravel-elixir');      elixir(function(mix) {         mix.sass('app.scss')             .browserify([                 'app.js'             ], 'public/js/app.js')             .version([                 'css/app.css',                 'js/app.js'             ]);     }); }); 

the generated file:

if use $ in pbnumberset.js, should import $ in file, not in app.js.

i suppose causes error.

you should still use browserify().


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -