Import modules via npm import #125
Answered
by
jeffreyvr
nikolailehbrink
asked this question in
Q&A
-
Hello, unfortunately I can not get any modules working via "import" and npm install. Here is an example for swiper.js
In app.js:
Then in single.php:
I also tried the almost same procedure for the aos-library but that didn't work as well. Would be nice, if you could give me an example on how to do it :) |
Beta Was this translation helpful? Give feedback.
Answered by
jeffreyvr
Jul 13, 2022
Replies: 1 comment 8 replies
-
This is setup from the Swiper documentation works for me:
import Swiper, { Navigation, Pagination } from 'swiper';
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination'; window.addEventListener('load', function () {
// ...
const swiper = new Swiper('.swiper', {
// configure Swiper to use modules
modules: [Navigation, Pagination]
});
}); |
Beta Was this translation helpful? Give feedback.
8 replies
Answer selected by
nikolailehbrink
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is setup from the Swiper documentation works for me:
resources/js/app.js