{"library":"native-addon-loader","title":"native-addon-loader","description":"A webpack loader for bundling .node native addon files. Version 2.0.1 supports configuring output filename and path relative to webpack's output path. It is designed for Node.js or Electron main process targets. Unlike generic file loaders, it ensures .node binaries are emitted intact and correctly referenced in the bundle. Stable API with simple options: 'name' for filename template and 'from' for adjustment of relative path from output directory to emitted file. Last updated in 2021; low maintenance cadence.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install native-addon-loader"],"cli":null},"imports":["module.exports = { module: { rules: [ { test: /\\.node$/, loader: 'native-addon-loader' } ] } }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// webpack.config.js\nconst path = require('path');\nmodule.exports = {\n  target: 'node',\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'js/[name].js'\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.node$/,\n        use: [\n          {\n            loader: 'native-addon-loader',\n            options: {\n              name: 'addons/[name]-[hash].[ext]',\n              from: 'js'\n            }\n          }\n        ]\n      }\n    ]\n  }\n};","lang":"javascript","description":"Shows how to configure native-addon-loader for a webpack build targeting Node.js, emitting .node files to a subdirectory with a content hash.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}