You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Loading via script src a local copy of a library doesn't create the window global that it does if the library were loaded from its absolute URL, or if the HTML file were open directly in the browser via file:///.
I expect that the code sample below works the same whether it's loaded by the browser via file:///, or by parcel index.html. The sample simply loads jQuery via script src in the HTML and logs $.
😯 Current Behavior
(index):6 Uncaught ReferenceError: $ is not defined
As far as I understand, Parcel expects you to reference your dependencies using relative FS paths, just like you require files in Node (const moduleX = require('./module-x.js')).
🐛 bug report
Loading via
script src
a local copy of a library doesn't create thewindow
global that it does if the library were loaded from its absolute URL, or if the HTML file were open directly in the browser viafile:///
.🎛 Configuration (.babelrc, package.json, cli command)
Zero-config.
🤔 Expected Behavior
I expect that the code sample below works the same whether it's loaded by the browser via
file:///
, or byparcel index.html
. The sample simply loads jQuery viascript src
in the HTML and logs$
.😯 Current Behavior
💁 Possible Solution
Including the full URL in
script src
works:🔦 Context
The use case is obviously not jQuery, but loading Pro/paid libraries that need to be downloaded separately and aren't available via npm or CDNs.
💻 Code Sample
Download/cURL/wget https://code.jquery.com/jquery-3.3.1.slim.min.js in the same directory as
index.html
.🌍 Your Environment
The text was updated successfully, but these errors were encountered: