eyereasoner 20.0.0 → 21.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/eye.d.ts +1 -1
- package/dist/eye.js +1 -1
- package/dist/lingua.d.ts +1 -1
- package/dist/lingua.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -218,6 +218,39 @@ Module.FS.writeFile('query.n3', query);
|
|
|
218
218
|
// Execute main(['--nope', '--quiet', './data.n3', '--query', './query.n3']).
|
|
219
219
|
eyereasoner.queryOnce(Module, 'main', ['--nope', '--quiet', './data.n3', '--query', './query.n3']);
|
|
220
220
|
```
|
|
221
|
+
## Using with Webpack
|
|
222
|
+
|
|
223
|
+
When bundling `eyereasoner` with Webpack for the browser, the underlying Emscripten-generated code may import Node.js built-in modules using the `node:` scheme (e.g. `node:fs`, `node:crypto`). Webpack does not handle the `node:` scheme by default and will produce errors like:
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
Module build failed: UnhandledSchemeError: Reading from "node:fs" is not handled by plugins (Unhandled scheme).
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
To fix this, add the following to your `webpack.config.js`:
|
|
230
|
+
|
|
231
|
+
```js
|
|
232
|
+
const { NormalModuleReplacementPlugin } = require('webpack');
|
|
233
|
+
|
|
234
|
+
module.exports = {
|
|
235
|
+
// ...your existing config
|
|
236
|
+
resolve: {
|
|
237
|
+
fallback: {
|
|
238
|
+
path: false,
|
|
239
|
+
fs: false,
|
|
240
|
+
crypto: false,
|
|
241
|
+
perf_hooks: false,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
plugins: [
|
|
245
|
+
new NormalModuleReplacementPlugin(/^node:/, (resource) => {
|
|
246
|
+
resource.request = resource.request.replace(/^node:/, '');
|
|
247
|
+
}),
|
|
248
|
+
],
|
|
249
|
+
};
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
The `NormalModuleReplacementPlugin` strips the `node:` prefix so that the imports are resolved by the `resolve.fallback` entries, which map them to `false` (i.e. empty modules) since they are not needed in the browser.
|
|
253
|
+
|
|
221
254
|
## Examples
|
|
222
255
|
|
|
223
256
|
We provide some examples of using `eyereasoner`:
|