import {$,jQuery} from 'jquery';
// export for others scripts to use
window.$ = $;
window.jQuery = jQuery;
First, as @nem suggested in comment, the import should be done from node_modules/
:
Well, importing from
dist/
doesn't make sense since that is your distribution folder with production ready app. Building your app should take what's insidenode_modules/
and add it to thedist/
folder, jQuery included.
Next, the glob –* as
– is wrong as I know what object I'm importing (e.g. jQuery
and $
), so a straigforward import statement will work.
Last you need to expose it to other scripts using the window.$ = $
.
Then, I import as both $
and jQuery
to cover all usages, browserify
remove import duplication, so no overhead here! ^o^y