Giter VIP home page Giter VIP logo

Comments (9)

rmp135 avatar rmp135 commented on May 29, 2024

I have a feeling this is due to the $' which is being parsed as a regex match when performing the injection. Pull request #31 refactored the code to use a string replace which should fix this issue.
In the meantime, you can use double quotes or string literals as a workaround.
I'll also write a test to cover this case.

from inject-loader.

vladimir-tikhonov avatar vladimir-tikhonov commented on May 29, 2024

@rmp135 you are right, $' -> $" did the trick. Thank you!

from inject-loader.

vladimir-tikhonov avatar vladimir-tikhonov commented on May 29, 2024

If someone is affected by the same or similar issue - i just wrote injectify-loader which has the same api/behaviour, but using babel tools under the hood (instead of regular expressions). I was able to just replace inject-loader with injectify-loader in my project - and everything was working like a charm.

from inject-loader.

plasticine avatar plasticine commented on May 29, 2024

@vladimir-tikhonov Hey, that’s pretty cool—nice work! I’d kinda been meaning to explore something like that for this module given the ubiquity of babel these days (was not the case as much back when I first wrote inject-loader), and the hackiness of using regex. Would you consider a PR?

from inject-loader.

vladimir-tikhonov avatar vladimir-tikhonov commented on May 29, 2024

@plasticine I've written injectify-loader from scratch, so the only type of pr I can submit is "remove everything from inject-loader / add everything from injectify-loader" 😄

from inject-loader.

plasticine avatar plasticine commented on May 29, 2024

@vladimir-tikhonov Heh, fair enough :simple_smile: I suspect the next time I get a chance to do some OSS stuff I’ll probably be looking at going in the same direction in this project anyway, but I can certainly understand that you might want to keep injectify-loader as a separate project. 👍

In the meantime, @rmp135 is correct in stating that his PR #31 should resolve the above issue.

from inject-loader.

vladimir-tikhonov avatar vladimir-tikhonov commented on May 29, 2024

@plasticine I just wanted to state that these projects have many differences, so if I submit a pr it will be a complete rewrite of this package. However, I can definitely do this, if you are ok with that. Moreover, I think that having only one package that does the right thing is much better for the js community.

from inject-loader.

plasticine avatar plasticine commented on May 29, 2024

@vladimir-tikhonov nah, I would not be opposed to that at all — this project has never really been a very complex idea or implementation, and your implementation is really great.

I would love to be able to rule out a whole category of bugs (i.e this one) that come from hacky regexes, by adopting babel to transform code instead (it may also allow for fixing #17 finally!). I think adopting babel for this task is really probably the right move.

If you’re willing, I’d love to work on getting your improvements across.

from inject-loader.

vladimir-tikhonov avatar vladimir-tikhonov commented on May 29, 2024

@plasticine okie dokie, I'll submit a pr in a couple of days

from inject-loader.

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.