I'm using parcel to bundle and develop my website and want to use SmoothState for the page transitions. I've downloaded the jquery.smoothState.min.js and included it in my scripts folder. I installed jquery using npm and it has been working fine so far. I've included this in the head of my HTML page:
<script src="scripts/jquery.smoothState.min.js"></script>
<script src="script.js" type="module"></script>
And this is the contents of script.js
var jquery = require("jquery");
window.$ = window.jQuery = jquery;
$(function() {
$('#main').smoothState();
});
When everything gets bundled, I get the error:
jQuery.Deferred exception: $(...).smoothState is not a function
I've tried removing the jquery module import lines in script.js and including the Jquery Google CDN above the two script tags in the HTML file but it results in the same error message.