# webpack-loader-rdf

> RDF/JS parsers (and serializers) are quite heavy, only work asynchrnously, and depend on various node-native modules, such as `stream` and `crypto`. This can be a nuisance when static RDF is imported early in an application becasue it unnecessarily increa

Latest version **0.2.0** (published 2022-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-loader-rdf
pnpm add webpack-loader-rdf
yarn add webpack-loader-rdf
bun add webpack-loader-rdf
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2022-03-18 |
| First published | 2021-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=13 |
| Dependencies | 4 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Tomasz Pluskiewicz |
| Maintainers | tpluscode |

## Links

- npm: https://www.npmjs.com/package/webpack-loader-rdf
- Repository: https://github.com/hypermedia-app/webpack-loader-rdf
- Homepage: https://github.com/hypermedia-app/webpack-loader-rdf#readme
- Issues: https://github.com/hypermedia-app/webpack-loader-rdf/issues
- npm.io page: https://npm.io/package/webpack-loader-rdf

## Dependencies (4)

- [rdf-utils-fs](https://npm.io/package/rdf-utils-fs.md) ^2.2.0
- [string-to-stream](https://npm.io/package/string-to-stream.md) ^3.0.1
- [@rdfjs/formats-common](https://npm.io/package/@rdfjs/formats-common.md) ^2.2.0
- [@rdfjs/serializer-rdfjs](https://npm.io/package/@rdfjs/serializer-rdfjs.md) ^0.1

## Recent versions

- 0.2.0 (latest) — 2022-03-18
- 0.1.1 — 2021-12-27
- 0.1.0 — 2021-12-27

## README

# webpack-loader-rdf [![Published on npm](https://img.shields.io/npm/v/webpack-loader-rdf.svg)](https://npm.im/webpack-loader-rdf)

RDF/JS parsers (and serializers) are quite heavy, only work asynchrnously, and depend on various node-native modules, such as `stream` and `crypto`. This can be a nuisance when static RDF is imported early in an application becasue it unnecessarily increases the size of the initial bundle and thus slows down the initial page load.

A webpack loader reserializes RDF into JS code so that it can be bundled along all other sources.

## Usage

```
npm i -D webpack-loader-rdf
```

In `webpack.config.js`

```js
module.exports = {
  module: {
    rules: [{
      test: /\.(ttl|nt|nq|rdf|jsonld|trig)$/,
      use: 'webpack-loader-rdf',
    }],
  }
}
```

In code:

1. Import your favourire [RDF/JS DataFatory](http://rdf.js.org/data-model-spec/#datafactory-interface)
2. Default-import RDF module
3. Combine the two to get a `Quad[]`

```js
import * as $rdf from '@rdf-esm/data-model'
import getPersonQuads from './data/person.ttl`

const personQuads = getPersonQuads($rdf)
```

## In TypeScript

Declare this module, for example in a `global.d.ts`, to get types for Turtle imports

```typescript 
declare module '*.ttl' {
  import { Quad, DataFactory } from 'rdf-js'

  export default function (factory: DataFactory): Quad[]
}
```

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