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

Is there a way to load a global but keep it scoped? #1228

Closed
nojaf opened this issue Apr 21, 2016 · 1 comment
Closed

Is there a way to load a global but keep it scoped? #1228

nojaf opened this issue Apr 21, 2016 · 1 comment

Comments

@nojaf
Copy link

nojaf commented Apr 21, 2016

I'm trying to load jQuery and a bootstrap plugin with Systemjs. The goal is to load the script files but not have jQuery added to the global scope.

Something like

<!DOCTYPE html>
<html>
<head>
    <title>System js demo</title>
    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<div id="app">
    <h1></h1>
    <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on left">Tooltip on left</button>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.23/system.js"></script>
<script type="text/javascript">
    "use strict";
    console.clear();
    (function() {
        System.import("https://code.jquery.com/jquery-2.2.3.min.js").then(function(n){
            System.import("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js").then(function(){
                console.log(n);
                n("button").tooltip();
                console.log(jQuery);
            });
        });
    })();
</script>
</body>
</html>

The problem is console.log(jQuery);. I was hoping that it would be undefined.
Is there a way to do this with Systemjs?

@guybedford
Copy link
Member

This is not supported, no. The feature is being tracked in #960.

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

No branches or pull requests

2 participants