I am trying to edit/understand the source of a modal plugin written in ES6, link HERE.
<div aria-hidden="true" class="modal micromodal-slide" id="modal-1">
<div class="modal__overlay" data-micromodal-close="" tabindex="-1">
<div aria-labelledby="modal-1-title" class="modal__container" role="dialog">
<header class="modal__header">
<h2 class="modal__title" id="modal-1-title">Micromodal</h2>
<button aria-label="Close modal" class="modal__close" data-micromodal-close=""></button>
</header>
<main class="modal__content" id="modal-1-content">
<p>Try hitting the <code>tab</code> key and notice how the focus stays within the modal itself. Also, <code>esc</code> to close modal.</p>
</main>
<footer class="modal__footer">
<button class="modal__btn modal__btn-primary">Continue</button> <button aria-label="Close this dialog window" class="modal__btn" data-micromodal-close="">Close</button>
</footer>
</div>
</div>
</div>
// Button that triggers the modal
<a data-micromodal-trigger="modal-1" href="#">Toggle</a>
// I am importing the source code for the plugin here
<script type="module" src="src/index.js"></script>
// File where i initialize the plugin
<script type="module" src="src/main.js"></script>
I initialize the plugin like so:
JS file (main.js)
import MicroModal from './index.js';
MicroModal.init();
Now if I want to debug the source code of the plugin, I directly edit the index.js
inside the /src
folder, is this the right way to do it or should I use some build version with source maps to debug this plugin?
EDIT::- This is not a general question on how to debug an ES6 plugin, please take into consideration this plugin uses yarn, web pack, rollupjs, and the question is how to debug this plugin in tandem with these tools.
EDIT 2::- I ran into this same issue again and this time , i am trying to debug a plugin called Glide.js.
Ofcourse i can use the plugin like so::
<div class="glide">
<div data-glide-el="track" class="glide__track">
<ul class="glide__slides">
<li class="glide__slide">
<img src="img/1.jpg" alt="">
<span>Slide 1</span>
</li>
<li class="glide__slide">
<img src="img/2.jpg" alt="">
<span>Slide 2</span>
</li>
<li class="glide__slide">
<img src="img/1.jpg" alt="">
<span>Slide 3</span>
</li>
</ul>
</div>
</div>
JS code to initialize :
import Glide from '../dist/glide.esm.js';
new Glide('.glide').mount();
My slider works , but what i'd really like to do is debug the code in the src/
folder , how do i go about doing this ?