Skip to content

Commit fd8210a

Browse files
committed
Fix externalizing sharp binary
1 parent 8260274 commit fd8210a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

webpack.config.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ module.exports = {
4242
path: path.resolve(__dirname, 'dist'),
4343
libraryTarget: 'commonjs2',
4444
},
45-
externals: {
46-
'../build/Release/sharp.node': './build/Release/sharp.node',
47-
},
45+
externals: ({ context, request }, callback) => {
46+
if (/.node$/.test(request)) {
47+
// if it's a binary, load as an external
48+
return callback(null, 'commonjs ' + request);
49+
}
50+
callback();
51+
}
4852
};

0 commit comments

Comments
 (0)