Skip to content

esm import cjs package with .node file require return a path string #3809

@wszgrcy

Description

@wszgrcy

like sharp package.
I use config

  loader: {
      '.node': 'file',
    },

when I import (Imported by other packages),after build ,The file sharp-linux-x64-DQNVFNDI.node has been successfully extracted
in sharp package

  module.exports = require(`../build/Release/sharp-${platformAndArch}.node`);

but module2.exports return a path string../sharp-linux-x64-DQNVFNDI.node

module2.exports = globRequire_build_Release_sharp_node(`../build/Release/sharp-${platformAndArch}.node`);

I try to use #1051 (comment) but not work
Is it because 'require' was not captured in the ESM?

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