-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Including files from node_modules in index.html causes export issues. #1483
Comments
Does your file in node_modules expose |
That works in some cases, but I can't even get something as simple as this to work. require('jquery/dist/jquery.js');
require('bootstrap/dist/js/bootstrap.min.js'); because |
The issue with jQuery is that it detects that if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true )/* runs in node & parcel*/ :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global ); /* runs in browser */
} |
Duplicate of #333 |
🐛 bug report
In my index.html if I do
It compiles fine but in the browser I get
myModule is not defined
.🤔 Expected Behavior
Included file should expose the instance/object correctly.
The text was updated successfully, but these errors were encountered: