Undefined site.min when building for production. #13

Closed
dannygarcia opened this Issue Sep 21, 2012 · 2 comments

Comments

Projects
None yet
1 participant

Running require('project/Site') does not work for built / minified projects when settings.TEMPLATE_DEBUG is false. Specifically, initializing throws the error: Cannot call method 'initialize' of undefined.

Here's an example setup:

<script src="/static/js/libs/require.js"></script>

<script>
    require.config({
        baseUrl : "/static/js",
        paths: {
            "project/Site" : "site.min"
        }
    });
</script>

<script>
    require(["project/Site"], function (site) {
        console.log(site); // undefined
        site.initialize(); // Uncaught TypeError: Cannot call method 'initialize' of undefined
    });
</script>

No other erors. It actually does load the site.min.js file.

Ah, @timrwood lended some insight here.

Looks like on https://github.com/ff0000/red-boilerplate/blob/plugins/rosy/resources/tasks/requirejs.js#L16

"/site" should be "/Site"

As a side note: should the require.js script tag be outside the conditional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment