question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v6] webpack: keytar native module has hardcoded path

See original GitHub issue
  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Using the default webpack template, my node native are loaded somewhat like this, using absolute path:

function(e, t, a) {
    (function (e) {
        try {
            global.process.dlopen(e, "D:\\path\\to\my\\repo\\node_modules\\keytar\\build\\Release\\keytar.node")
        } catch (e) {
            throw new Error("Cannot open D:\\path\\to\my\\repo\\node_modules\\keytar\\build\\Release\\keytar.node: " + e)
        }
    }
    ).call(this, a(61)(e))
}

Obviously, it works fine till I blast my node_module folder to oblivion, but as soon as I do, or -more importantly- try to distribute my app, it doesn’t work.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

12reactions
ThomasSzabocommented, Feb 20, 2020

Thanks @shezuka-monkey!! That fixed it for me:

Before webpack.rules.js

module.exports = [
  // Add support for native node modules
  {
    test: /\.node$/,
    use: 'node-loader',
  },
  {
    test: /\.(m?js|node)$/,
    parser: { amd: false },
    use: {
      loader: '@marshallofsound/webpack-asset-relocator-loader',
      options: {
        outputAssetBase: 'native_modules',
      },
    },
  },
];

After webpack.rules.js

module.exports = [
  // Add support for native node modules
  {
    test: /\.(m?js|node)$/,
    parser: { amd: false },
    use: {
      loader: '@marshallofsound/webpack-asset-relocator-loader',
      options: {
        outputAssetBase: 'native_modules',
      },
    },
  },
];
3reactions
shezuka-monkeycommented, Dec 9, 2019

Got it work Changes that I made:

  1. Update package @zeit/webpack-asset-relocator-loader version from 0.5.0 to 0.6.2
  2. Changed main config:
module.exports = {
  entry: './src/index.js',

  module: {
    rules: [
      {
        test: /\.(m?js|node)$/,
        parser: { amd: false },
        use: {
          loader: '@zeit/webpack-asset-relocator-loader',
          options: {
            outputAssetBase: 'assets'
          },
        },
      },
    ]
  }
};

There was module node-loader And property node: { __dirname: true }

Read more comments on GitHub >

github_iconTop Results From Across the Web

[v6] webpack: keytar native module has hardcoded path #1029
Try to run: initial error of the post Cannot open D:\\path\\to\my\\repo\\node_modules\\keytar\\build\\Release\\keytar.node: I noticed that ...
Read more >
Electron Forge v6, Keytar & Node-Loader Error "no suitable ...
I cannot decipher what is happening as I can see the package .node files are copied into ./webpack/main/native_modules , but there is a...
Read more >
node-loader - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Untitled
#degree Digitalizacija na tv makedonija, Watch the nanny season 6 episode 7, Bird feather clipart, Indian jewelry set for wedding, Adding exponents with...
Read more >
Zowe Version 1.26 Documentation
ZSS is written in C and has native calls to z/OS to provide its services. ... Plug-in: Enabled support on Node.js v14 by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found