Coder Social home page Coder Social logo

commonjs + inject about plugins HOT 9 CLOSED

rollup avatar rollup commented on May 18, 2024 1
commonjs + inject

from plugins.

Comments (9)

shellscape avatar shellscape commented on May 18, 2024

@drzraf I'm afraid you'll have to distill this issue a bit further before we can triage it. Please identify what isn't working within @rollup/plugin-inject, or rollup-plugin-commonjs. Once you have it narrowed down, we'll be able to help you further.

from plugins.

shellscape avatar shellscape commented on May 18, 2024

@drzraf please see the previous reply. If that's something you're willing to tackle, we'll be happy to reopen this issue.

from plugins.

drzraf avatar drzraf commented on May 18, 2024

I can't go further than what I already provided. Sorry to see such a high entry bar to bugfixes

from plugins.

shellscape avatar shellscape commented on May 18, 2024

Everyone here volunteers their time to work on the project. When users come here with issues that involve complex configurations or reproductions, we ask that they distill the config or repro down to a simple form that highlights the issue faced. We simply don't have the time or resources to deep dive nuanced configs. That's why we ask for minimal reproductions in the issue template.

I'm sorry that you can't reduce your reproduction further, and that you feel that triage is creating a high entry bar. Perhaps someone else who can will pick this up in the future.

from plugins.

Andarist avatar Andarist commented on May 18, 2024

@shellscape i take a quick look at provided repro and it seems to be pretty minimal

from plugins.

shellscape avatar shellscape commented on May 18, 2024

@Andarist We've asked for the conflict between the two plugins to be distilled further in an earlier reply.

from plugins.

Andarist avatar Andarist commented on May 18, 2024

I think the root cause here is quite simple - I've stumbled upon a really similar issue lately while debugging it.

Problem is that @rollup/plugin-inject injects import statements, so it makes automatically a module out of the given file, even if it's just a script - like in your case because your files are written using commonjs. And this makes rollup-plugin-commonjs to think that what it receives is already a module and it skips transforming it altogether, so it just leaves your module.exports and such intact.

In this particular case, you can reorder your plugins - put rollup-plugin-commonjs before @rollup/plugin-inject so a commonjs plugin can make its magic first and transform your scripts to modules.

from plugins.

drzraf avatar drzraf commented on May 18, 2024

Thank you for the proposed workaround @Andarist.
It resolves the problem in the context of this repro (In my real codebase I remember having hit another issue when changing plugin order. I'll let you know here if I hit it again)

I updated repository's testcase in the meantime.

from plugins.

walmon avatar walmon commented on May 18, 2024

I'm also experiencing it. Hopefully it can be addressed.

from plugins.

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.