Good afternoon,
I’m having a bit of an issue with external JS import.
The documentation doesn’t make it very clear on what the best path is. I followed the instructions (as per slick) and made no headway.
Firstly I added the package with yarn:
yarn add body-scroll-lock --dev
Then I added this to the top of the common.js file:
import bodyScrollLock from 'body-scroll-lock/lib/bodyScrollLock.min';
And then under “finalize(){” again in common JS this fails everytime:
const disableBodyScroll = bodyScrollLock.disableBodyScroll;
const enableBodyScroll = bodyScrollLock.enableBodyScroll;
With the error:
common.js:31 Uncaught TypeError: Cannot read property 'disableBodyScroll' of undefined
at Object.finalize (common.js:31)
at Router.fire (Router.js:38)
at Router.loadEvents (Router.js:67)
at HTMLDocument.<anonymous> (main.js:30) etc etc etc
I have tried the import in my main.js file which refused to compile and have been going around in circles looking for a solution to no avail ever since.
I’m sure I’m doing something really basic wrong but don’t know where to start troubleshooting.
Any tips or hints gratefully received and I thank you kindly in advance…
Side Q: Are these subjects covered in depth in the 'Theme Development With Sage" Book? If not could anyone point me to a source of learning tools on the subject. Thankyou!