Code Monkey home page Code Monkey logo

Comments (9)

hardchor avatar hardchor commented on August 17, 2024

Have you tried specifying the jquery path without the .j's suffix?

from hearsayrequirejsbundle.

jameshalsall avatar jameshalsall commented on August 17, 2024

@IgorTimoshenko @kmontag I think this is an issue, I get the same error when using requirejs 2.1.8 and the new shim:

My config for requirejs:

hearsay_require_js:
    require_js_src: http://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.8/require.min.js
    optimizer:
        path: %requirejs_bin%
    base_directory: %kernel.root_dir%/Resources/public/js
    paths:
        jquery: "@AcmeCoreBundle/Resources/public/js/vendor/jquery/jquery"
        jqueryui: %kernel.root_dir%/Resources/public/js/vendor/jquery-ui-1.10.3.min
    shim:
        -
            name: jquery
            exports: '$'
        -
            name: jqueryui
            deps: [jquery]

I initialise with the usual block and filter:

{% javascripts filter='requirejs' '@AcmeCoreBundle/Resources/public/js/App.js' %}
    {{ require_js_initialize({ 'main' : asset_url }) }}
{% endjavascripts %}

My App.js looks like:

    require([
    'jquery',
    'jqueryui'
], function() {
    // do some stuff
});

The output of my App.js file shows an error:

exception] 500 | Internal Server Error | RuntimeException
[message] Optimization failed:
Tracing dependencies for: 3c232fb4317c3fdfa4dad91432e6d7a6
Error: ENOENT, no such file or directory > '/Library/WebServer/Documents/tickit/src/Tickit/CoreBundle/Resources/public/js/vendor/jquery/jquery.js.js'
In module tree:
3c232fb4317c3fdfa4dad91432e6d7a6

For some reason it's double suffixing the jquery library, but as you can see I'm not defining it with with the suffix in my paths config.

from hearsayrequirejsbundle.

ihortymoshenko avatar ihortymoshenko commented on August 17, 2024

@jameshalsall, what's the version of the bundle?

from hearsayrequirejsbundle.

jeelo avatar jeelo commented on August 17, 2024

Not sure if relevant but i had fixed it by overriding the optimizer filter:

class RequireJSOptimizerFilter extends Filter
{

/**
 * Override set option method
 *
 * @param string $name  name
 * @param string $value value
 *
 * @return void
 */
public function setOption($name, $value)
{
    if (is_file($value)) {
        $value = substr($value, 0, -3);
    }
    $this->options[$name] = $value;
}

}

and creating a service compiler pass:

class OverrideServiceCompilerPass implements CompilerPassInterface
{
/**
* You can modify the container here before it is dumped to PHP code.
*
* @param ContainerBuilder $container container
*
* @return void
* @api
*/
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('hearsay_require_js.optimizer_filter');
$definition->setClass('Namespace\CommonBundle\Filter\RequireJSOptimizerFilter');
}

}

from hearsayrequirejsbundle.

jameshalsall avatar jameshalsall commented on August 17, 2024

@IgorTimoshenko dev-master, latest release

from hearsayrequirejsbundle.

jameshalsall avatar jameshalsall commented on August 17, 2024

@jeelo thanks for the solution, I will implement this in the meantime - @IgorTimoshenko can you confirm that this is an issue?

from hearsayrequirejsbundle.

ihortymoshenko avatar ihortymoshenko commented on August 17, 2024

@jameshalsall, I didn't have an ability to check it. Anyway, I'll check it.

from hearsayrequirejsbundle.

jameshalsall avatar jameshalsall commented on August 17, 2024

@IgorTimoshenko appreciated. I'm also now seeing an issue in the travis build for my project (https://travis-ci.org/tickit-project/tickit/jobs/9442345#L757) with FilenamesResource::isFresh();

It doesn't look like its resolving the file path names when they have no file extension.

from hearsayrequirejsbundle.

ihortymoshenko avatar ihortymoshenko commented on August 17, 2024

@jeelo, I close this issue. You specified the path with the .js file extension. I have recently added the check in order to prevent specifying the paths with file extensions. Besides, I've checked it with the latest version of the r.js (2.1.8) and all works.

@jameshalsall, your issue we discuss here #39.

from hearsayrequirejsbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.