Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces 1 character too many, causing source errors #4

Open
freshollie opened this issue Apr 18, 2020 · 1 comment
Open

Replaces 1 character too many, causing source errors #4

freshollie opened this issue Apr 18, 2020 · 1 comment

Comments

@freshollie
Copy link

freshollie commented Apr 18, 2020

This loader causes source files like:

const bindings = require('bindings')('somebinding.node')
const someOtherImport = require("some-import")

To become invalid:

const bindings = require('somebinding.node')const someOtherImport = require("some-import")

The fix is:

      replaceSource.replace(
        match.index,
        pattern.lastIndex - 1,
        forPath
          ? JSON.stringify(addonRequest)
          : `require(${JSON.stringify(addonRequest)})`
      );

I've not submitted a PR because I'm not sure if this repo is maintained anymore :)

@freshollie
Copy link
Author

@simonbuchan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant