node-loader-relative v0.0.3
Node Loader For Relative Path
Package for loading native files in Node and Electron applications. The project is inspired by the native-ext-loader. It works in the similar way but allows to build relative path at runtime.
Installation
Add the package to the development dependencies:
# using npm:
$ npm install node-loader-ralative --save-dev
# using yarn:
$ yarn add --dev node-loader-ralativeUsage
Update rules entry in the Webpack configuration file: (same as node-loader)
module: {
rules: [
{
test: /\.node$/,
loader: "node-loader-ralative"
}
];
}Options
Options are configurable using options hash:
module: {
rules: [
{
test: /\.node$/,
loader: "node-loader-ralative",
options: {
basePath: __dirname
}
}
];
}basePath (default: undefined)
It allows to set a path that will be the basic webpack config path to load native files.
Note that, when undefined, there is no different with node-loader; when path setted(usually it is __dirname, also the webpack config path), this package will calculate out the relative path from the param path, by path.relative in node native module and load correctly.
If any error is cached, you could log filePath manually to check it.
Releasing a new version
- Bump version number in the
package.jsonandCHANGELOG.mdfiles. - Run
npm installto updatepackage-lock.jsonfile. - Commit changes (include changes)
- Add a new tag (use
-aand include changes) - Push commits and tag
- Run
npm publish