Hi, I have added SmoothScroller to my wp installation and I can see that the files are loaded, however I'm getting the below error.
Uncaught SyntaxError: Unexpected token 'export' (at ScrollSmoother.js?ver=6.0.1:85:1)
When looking at the smoothscroller.js file, if I comment out the /*#__PURE__*/ in the line where the error is being generated the error goes away but SmoothScroller still will not load when checking with window.SmoothScroller in the console. Is this comment the issue or am I missing something in the installation?
export var ScrollSmoother = /*#__PURE__*/function () {
This is my current set up from what I found in the forums, any help is greatly appreciated.
// The proper way to enqueue GSAP script
// wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );
function theme_gsap_script() {
wp_enqueue_script( 'gsap-js2', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/gsap.min.js', array('wp-mediaelement'), false, true );
wp_enqueue_script( 'gsap-st', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/ScrollTrigger.min.js', array(), false, true );
wp_enqueue_script( 'gsap-smoother', get_stylesheet_directory_uri() . '/node_modules/gsap/ScrollSmoother.js', array(), false, true );
}
add_action( 'wp_enqueue_scripts', 'theme_gsap_script' );