Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
native-ext-loader
Advanced tools
Package for loading native files in Node and Electron applications. The project is inspired by the node-addon-loader. It works in the similar way but allows to build path at runtime.
Add the package to the development dependencies:
# using npm:
$ npm install native-ext-loader --save-dev
# using yarn:
$ yarn add --dev native-ext-loader
Update rules entry in the Webpack configuration file:
module: {
rules: [
{
test: /\.node$/,
loader: "native-ext-loader"
}
];
}
Options are configurable using options
hash:
module: {
rules: [
{
test: /\.node$/,
loader: "native-ext-loader",
options: {
rewritePath: path.resolve(__dirname, "dist")
}
}
];
}
basePath
(default: []
)It allows adjusting path to the native module. The array will be concatenated with the resource name and then used in the runtime. For example, when the compile application lives inside app.asar/renderer
subdirectory (Electron package), the path to the native module can be adjusted by using basePath: ['app.asar', 'renderer']
.
Note that basePath
is ignored when rewritePath
option is used.
rewritePath
(default: undefined
)It allows to set an absolute paths to native files.
Note that it needs to remain undefined
if you are building a package with embedded files. This way, the compiled application will work no matter of its location. This is important when building Electron applications that can be placed in any directory by the end user.
emit
(default: true
)Specifies whether the imported .node
file will be copied to the output directory.
package.json
and CHANGELOG.md
files.npm install
to update package-lock.json
file.-a
and include changes)npm publish
FAQs
Loader for Node native extensions
We found that native-ext-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.