Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Replaces 1 character too many, causing source errors #4

@freshollie

Description

@freshollie

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions