Code Monkey home page Code Monkey logo

Comments (7)

karellm avatar karellm commented on August 10, 2024

Hey Julian,

I think you should exclude: ["jquery"] because common isn't a dependency of your page1.js.


Though, I have the following solution that doesn't seem to work:

My app.js: define["module1", "module2"], { // ... })

My module1.js: define["ckeditor/ckeditor", { //... })

My requirejs.yml:

paths:
  ckeditor: "ui/ckeditor"
modules:
  - name: 'app'
    exclude: ['ckeditor/ckeditor']

Though, ckeditor is still included. I tried to exclude ckeditor with ckeditor, ui/ckeditor/ckeditor and ckeditor/ckeditor. None seems to work.

Any clue?

from requirejs-rails.

karellm avatar karellm commented on August 10, 2024

I created a fork up until John merges or fixes it:

#31

If you want to test it, replace the requirejs-rails line in your gemfile with:
gem 'requirejs-rails', :git => 'https://github.com/karellm/requirejs-rails'

from requirejs-rails.

jmaicher avatar jmaicher commented on August 10, 2024

Thanks for you bugfix @karellm.

Take a look at the example in the docs: http://requirejs.org/docs/faq-optimization.html#priority

If I exclude common then the optimized page1 module shouldn't include common's modules and their nested dependencies.

from requirejs-rails.

karellm avatar karellm commented on August 10, 2024

Indeed it makes a lot of sense as it excludes all dependencies of the excluded module. Thanks for the info.

from requirejs-rails.

 avatar commented on August 10, 2024

I've also experienced this problem. The exclude directive doesn't seem to work for either direct dependencies or their nested dependencies. My workaround has been to force exclusion at the module level by declaring dependencies using variables, as per the example on http://requirejs.org/docs/optimization.html .

from requirejs-rails.

karellm avatar karellm commented on August 10, 2024

That is a nice workaround but my fork fixes the bug in the gem directly so your code can remain clean of any hack.

from requirejs-rails.

jwhitley avatar jwhitley commented on August 10, 2024

Hi all. I'm going get a fix for this into the next release, which I expect to kick out over the weekend. @karelim, thanks for pull request #31. I'll review that and pull it assuming that I have no feedback/changes.

from requirejs-rails.

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.