Skip to content

How to load with requirejs? #8

@ericsvendsen

Description

@ericsvendsen

My project uses requirejs to manage dependencies, and when I set up the config for knockout and then observableDictionary, I get a "ko is not defined" error, I think because your code is expecting ko to be in the global scope. My config looks like this:

requirejs.config({
    paths: {
        'knockout': '../Scripts/knockout-2.3.0',
        'observableDictionary': '../Scripts/observableDictionary'
    },
    shim: {
        'observableDictionary': {
            deps: ['knockout'],
            exports: 'observableDictionary'
        }
    }
});

The only solution I have at the moment is to wrap your code in a define block, but that's obviously not a good long-term solution. I'm pretty new to requirejs so it's entirely possible that I'm missing something. Any insight you might have would be great. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions