Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script tag in HTML #3915

Closed
grigorii-horos opened this issue Dec 14, 2019 · 3 comments
Closed

Script tag in HTML #3915

grigorii-horos opened this issue Dec 14, 2019 · 3 comments

Comments

@grigorii-horos
Copy link

grigorii-horos commented Dec 14, 2019

❔ Question

I have a deprecated site with html with

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/main.js"></script>

But in main.js appear error '$ not defined'.
I understand that Parcel wraps the content of jquery.js and $ doesn't appear in window.
How I can add script tag is as without wrapping/modifications?

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel
Node
npm/Yarn
Operating System
@mischnic
Copy link
Member

You could:

  • use a CDN for jQuery
  • import jQuery in main.js like this import jquery from "jquery";
  • create a wrapper jquery.js that doesn: import jquery from "jquery"; window.$ = jquery;

@grigorii-horos
Copy link
Author

@mischnic OK, I understand that I can use CDN. But I have not the only jQuery, but I also have a lot of HTML files, with large set of dependencies.

@mischnic
Copy link
Member

Please see #357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants