Skip to content

Commit ba95925

Browse files
committed
Fix Buffer not defined errors
1 parent b912610 commit ba95925

File tree

3 files changed

+703
-6
lines changed

3 files changed

+703
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"leaflet": "^1.7.1",
7171
"minimist": "^1.2.5",
7272
"n3": "^1.16.2",
73+
"node-polyfill-webpack-plugin": "^2.0.1",
7374
"rdf-string": "^1.6.1",
7475
"relative-to-absolute-iri": "^1.0.6",
7576
"string-replace-loader": "^3.1.0",

webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const path = require('path');
22
const webpack = require('webpack');
3+
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
34

45
// First check if we can load Comunica form cwd, if not, fallback to the default
56
let pathToComunica;
@@ -142,6 +143,9 @@ module.exports = [
142143
},
143144
plugins: [
144145
new webpack.ProgressPlugin(),
146+
new NodePolyfillPlugin({
147+
includeAliases: ['Buffer'], // Buffer global is still needed due to the jsonparser library
148+
}),
145149
new webpack.NormalModuleReplacementPlugin(/^my-comunica-engine$/, path.join(process.cwd(), '.tmp-comunica-engine.js')),
146150
...comunicaOverride ? [] : [
147151
new webpack.NormalModuleReplacementPlugin(/^\@comunica/, (resource) => {

0 commit comments

Comments
 (0)