I dowloaded a HTML, CSS, JS website template to create a wordpress theme.
I donwnload wordpress/scripts to bundle all asset files into two: index.css and index.js
Here is my entry index.js:
`
import "./sass/main.scss";
import "./js/jquery-3.6.0.min.js";
import "./js/popper.min.js";
import "./js/bootstrap.min.js";
import "./js/swiper-bundle.min.js";
import "./js/waypoints.min.js";
import "./js/jquery.counterup.min.js";
import "./js/isotope.pkgd.min.js";
import "./js/jquery.magnific-popup.min.js";
import "./js/wow.min.js";
import "./js/custom.js";
`
After running npm start the wordpress/scripts creates a build folder with index.css ad index.js.
Inside functions.php and enequeue index.css and index.js.
Inside the front-page.php i passed all the contents of the original html template.
And it is throwing an error on console:
`
waypoints.min.js:7 Uncaught TypeError: Cannot read properties of undefined (reading 'each')
at waypoints.min.js:7
at Object../src/js/waypoints.min.js (waypoints.min.js:7)
at __webpack_require__ (bootstrap:19)
at make namespace object:7
at index.js:10
at index.js:10
`
Inspecting the error line:
`
e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$elemen
` (Since its minified i cannot show all the code)
When i open the original html file on the browser, it works perfectly. Only when i try to use in wordpress.
What may be the cause?
Thanks in advance.