# pgml-nextjs-node-loader

> Allows you to include native Node.js `.node` modules in your Next.js project

Latest version **1.1.5** (published 2023-08-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install pgml-nextjs-node-loader
pnpm add pgml-nextjs-node-loader
yarn add pgml-nextjs-node-loader
bun add pgml-nextjs-node-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2023-08-23 |
| First published | 2023-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10.13.0 |
| Dependencies | 1 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | PostgresML |
| Maintainers | shyper |
| Keywords | webpack, nextjs, loader, node.js, node-loader, native-modules |

## Links

- npm: https://www.npmjs.com/package/pgml-nextjs-node-loader
- Repository: https://github.com/postgresml/pgml-nextjs-node-loader
- Homepage: https://github.com/postgresml/pgml-nextjs-node-loader#readme
- Issues: https://github.com/postgresml/pgml-nextjs-node-loader/issues
- npm.io page: https://npm.io/package/pgml-nextjs-node-loader

## Dependencies (1)

- [loader-utils](https://npm.io/package/loader-utils.md) ^2.0.3

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.1.5 (latest) — 2023-08-23

## README

# pgml-nextjs-node-loader

This is a fork of: https://github.com/eisberg-labs/nextjs-node-loader

This is a custom loader for Webpack that allows you to include native Node.js `.node` modules in your Next.js project.
It simplifies the process of loading native modules by providing a standardized interface that works seamlessly with
Next.js.

## Getting Started

To begin, you'll need to install a `nextjs-node-loader`:

```console
npm install nextjs-node-loader --save-dev
```

**next.config.js**

```js
module.exports = {
  webpack: (config, { dev, isServer, webpack, nextRuntime }) => {
    config.module.rules.push({
      test: /\.node$/,
      use: [
        {
          loader: "nextjs-node-loader",
          options: {
            flags: os.constants.dlopen.RTLD_NOW,
            outputPath: config.output.path,
          },
        },
      ],
    });
    return config;
  },
};
```

And use in e.g. your api route;

```javascript
import module from "node-module";

export default function handler(req, res) {
  // ...
}
```

## Options

|    Name    |    Type    |       Default        | Description                                           |
| :--------: | :--------: | :------------------: | :---------------------------------------------------- |
|   flags    | `{Number}` |     `undefined`      | Enables/Disables `url`/`image-set` functions handling |
| outputPath | `{String}` | webpack's outputPath | The root path of shared node libraries                |

## License

[MIT](./LICENSE)

---
_Source: https://npm.io/package/pgml-nextjs-node-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
