Closed ahmed-amir-azouzi closed 2 years ago
Hei @ahmed-amir-azouzi, that's really sad that you're figuring issues trying to run ClipboardJS in your project.
Looks like an issue with GitHub Pages, which ignores node_modules
folder. You can try what is suggested here. Closing your issue for now, since it's not related to ClipboardJS directly. Feel free to reopen if needed.
Okay, understood. Thank you for your response.
On Tue, Sep 13, 2022 at 6:33 PM Beto Muniz @.***> wrote:
Hei @ahmed-amir-azouzi https://github.com/ahmed-amir-azouzi, that's really sad that you're figuring issues trying to run ClipboardJS in your project.
Looks like an issue with GitHub Pages, which ignores node_modules folder. You can try what is suggested here https://stackoverflow.com/questions/43481269/github-pages-404-on-node-modules-folder. Closing your issue for now, since it's not related to ClipboardJS directly. Feel free to reopen if needed.
— Reply to this email directly, view it on GitHub https://github.com/zenorocha/clipboard.js/issues/817#issuecomment-1245726203, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG2OODS632D4K5U33ANULDDV6C3FVANCNFSM57YOKIHA . You are receiving this because you were mentioned.Message ID: @.***>
Bug Description
I was using ClipboardJS on a personal project. When I open the project from my development environment, everything works fine.
But as soon as I uploaded my project on Github, and hosted it with Github pages, the clipboard copy functionality stopped, and this error message appeared in firefox developer tool.
Bug mitigation
And then I stumbled upon a forum discussion where it seemed that this was a common bug; in production environment, loading ClipboardJS from MDN server instead of locally (from "node_modules" file) resolved the bug.
so, in the "index.html" file, on line 46, I have changed this
<script src="./node_modules/clipboard/dist/clipboard.min.js"></script>
with this<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.10/dist/clipboard.min.js"></script>
P.S
I think this has to do with the ClipboardJS package. My app was really simple, and ClipboardJS was the only package installed.
Development environment
OS: Ubuntu v22.04.1 LTS Web Browser: Firefox v104 npm v8.15.0 && node v16.17.0 IDE: VScode v1.70.2 project's github repo: https://github.com/ahmed-amir-azouzi/vanillaJS-link-shortener/ project's live demo: https://ahmed-amir-azouzi.github.io/vanillaJS-link-shortener/