Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Incorrect <script> output in production #69

@ckovey

Description

@ckovey

In production I'm seeing html generated that looks like

 <script type="text/javascript" src="platform/main"></script>

Which obviously won't load any js. I've tried cache:clear, assets:install, assetic:dump to no avail.

Any pointers as to what I might be doing wrong? Here are my settings:

config.yml

hearsay_require_js:
    require_js_src:      //cdnjs.cloudflare.com/ajax/libs/require.js/2.1.8/require.min.js
    initialize_template: HearsayRequireJSBundle::initialize.html.twig
    base_url:            "js/app"
    base_dir:            %node_prefix%/lib/node_modules/requirejs/bin/
    paths:
        backbone:
            location: "@MyAppCoreBundle/Resources/public/components/backbone/backbone"
        backgrid:
            location: "@MyAppCoreBundle/Resources/public/components/backgrid/lib/backgrid"
        bootstrap:
            location: "@MyAppCoreBundle/Resources/public/components/bootstrap/dist/js/bootstrap"
        bridge:
            location: "@MyAppBridgeBundle/Resources/public/js/src/bridge"
        editor:
            location: "@MyAppEditorBundle/Resources/public/js"
        jquery:
            location: "@MyAppCoreBundle/Resources/public/components/jquery/dist/jquery.min"
        jquery.unveil:
            location: "@MyAppCoreBundle/Resources/public/components/unveil/jquery.unveil"
        modernizr:
            location: "@MyAppCoreBundle/Resources/public/components/modernizr/modernizr"
        platform:
            location: "@MyAppPlatformBundle/Resources/public/js"
        underscore:
            location: "@MyAppCoreBundle/Resources/public/components/underscore/underscore"
    shim:
        backbone:
            deps:    [ jquery, underscore ]
            exports: Backbone
        backgrid:
            deps:    [ backbone ]
            exports: Backgrid
        bootstrap:
            deps:    [ jquery ]
        jquery.unveil:
            deps:    [ jquery ]
        modernizr:
            exports: Modernizr
        underscore:
            exports: _
    options:
    optimizer:
        path:                    %node_prefix%/lib/node_modules/requirejs/bin/r.js
        hide_unoptimized_assets: false
        almond_path:             %node_prefix%/lib/node_modules/almond/almond.js
        exclude:                 []
        options:
        timeout: 60

layout.html.twig

<body class="{% if app.user %} authenticated{% endif %} {{ body_class|default('') }}">

  {# Output body #}
  {% block body %}{% endblock %}

  {# Platform RequireJS #}
  {% javascripts output='js/app/editor.js' filter='requirejs'
    '@MyAppPlatformBundle/Resources/public/js/main.js'  %}
    {{ require_js_initialize({ 'main' : 'platform/main' }) }}
  {% endjavascripts %}
</body>

development output

<script type="text/javascript">var require={"baseUrl":"\/js\/app","locale":"en","paths":{"backbone":"\/js\/app\/backbone\/backbone","backgrid":"\/js\/app\/backgrid\/backgrid","bootstrap":"\/js\/app\/bootstrap\/bootstrap","bridge":"\/js\/app\/bridge","editor":"\/js\/app\/editor","jquery":"\/js\/app\/jquery\/jquery.min","jquery.unveil":"\/js\/app\/jquery.unveil\/jquery.unveil","modernizr":"\/js\/app\/modernizr\/modernizr","platform":"\/js\/app\/platform","underscore":"\/js\/app\/underscore\/underscore","":"\/js\/app\/"},"shim":{"backbone":{"deps":["jquery","underscore"],"exports":"Backbone"},"backgrid":{"deps":["backbone"],"exports":"Backgrid"},"bootstrap":{"deps":["jquery"]},"jquery.unveil":{"deps":["jquery"]},"modernizr":{"exports":"Modernizr","deps":[]},"underscore":{"exports":"_","deps":[]}}};</script><script type="text/javascript" data-main="platform/main" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.8/require.min.js"></script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions