Skip to content

Commit c2a6635

Browse files
Copilotrubensworks
andauthored
Fix webpack web build: NormalModuleReplacementPlugin for node: scheme + @ts-expect-error placement in test-web.ts
Agent-Logs-Url: https://github.com/LinkedSoftwareDependencies/Components.js/sessions/698e2c3d-ab12-4daf-ab1d-8d5a3bb235a2 Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
1 parent 9059964 commit c2a6635

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

test/webpack/test-web.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-disable no-console, unicorn/no-process-exit */
22

3-
// Monkey patch in the window object so we can test the script in Node
4-
// @ts-expect-error
53
import { RdfObjectLoader } from 'rdf-object';
64
import { RdfParser, ComponentsManagerBuilder } from '../..';
75

6+
// Monkey patch in the window object so we can test the script in Node
7+
// @ts-expect-error
88
globalThis.window = globalThis;
99
const arrayifyStream = require('stream-to-array');
1010
const streamifyString = require('streamify-string');

test/webpack/webpack.config-web.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ module.exports = [
2929
new webpack.DefinePlugin({
3030
'process.platform': JSON.stringify('browser'),
3131
}),
32+
new webpack.NormalModuleReplacementPlugin(/^node:/, (resource) => {
33+
resource.request = resource.request.replace(/^node:/, '');
34+
}),
3235
],
3336
resolve: {
3437
fallback: {

0 commit comments

Comments
 (0)