Skip to content
This repository was archived by the owner on Apr 2, 2020. It is now read-only.
This repository was archived by the owner on Apr 2, 2020. It is now read-only.

How to prevent twice loading for scripts that doesn't add a window alias like bluebird.js? #89

@bernardoduarte

Description

@bernardoduarte

Hello there, I'm trying to use fallback.js to load bluebird.js, but since bluebird doesn't add any window alias, how am I supposed to prevent twice loading?

Below is an example of how I've achieved this, but it's a hack so I'm trying to find a correct way to do this.

<script src="{% static 'assets/js/fallback.min.js' %}"></script>
<script>
fallback.load({
    'Vue': [
        '//cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js',
        '{% static "assets/js/vue.min.js" %}'
    ],
    'VueResource': [
        '//cdn.jsdelivr.net/npm/vue-resource@1.5.1/dist/vue-resource.min.js',
        '{% static "assets/js/vue-resource.min.js" %}'
    ],
    'Cookies': [
        '//cdn.jsdelivr.net/npm/js-cookie@2.2.0/src/js.cookie.min.js',
        '{% static "assets/js/js.cookie.min.js" %}'
    ],
    'Object.hasOwnProperty.call((new Promise(function() {})), "_promise0")': [
        '//cdn.jsdelivr.net/npm/bluebird@3.5.3/js/browser/bluebird.min.js',
        '{% static "assets/js/bluebird.min.js" %}'
    ],
}, {
    shim: {}
});
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions