Git Product home page Git Product logo

Comments (2)

jrburke avatar jrburke commented on June 6, 2024

Right, I have hit this too, and it is a bit tricky to fix. Normally dependencies are not completely evaluated, the AST parser just pulls out the name, module dependencies and evaluates that for the module. This is important since some modules may depend on browser-specific, or env-specific variables (like window or document). However, for plugins, it does evaluate the whole file. But the system only knows it is a plugin if the name has been used as part of plugin resource.

What I need to do is allow a module definition to be "reset" if already defined when it is later seen as a plugin, or used as a plugin dependency. However, that can be tricky to know (ideally if 'text' had dependencies, those would be completely evaluated). I think it may work out given the synchronous nature of module loading in the optimizer, but it will require some fancier bookkeeping and module reset logic.

I have already hit a few cases where it would be nice to reuse the text plugin as a basis for other plugins (like the coffeescript plugin), but I ended up inlining the text plugin work in the other plugin to get around the limitation outlined in this issue. So I definitely see the usefulness of supporting it, it just make take a bit of time to sort out.

As a hack, if you specify a text resource first in the build dependencies for a layer, before the above plugin is used, then it may work out.

from r.js.

jrburke avatar jrburke commented on June 6, 2024

This should now be fixed in the the latest code. Try this snapshot.

from r.js.

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.