We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ed06928 commit e503507Copy full SHA for e503507
src/index.js
@@ -4,7 +4,13 @@
4
5
import * as opentype from 'opentype.js';
6
7
-const DEFAULT_FONT = require('path').join(__dirname, '../fonts/ipag.ttf');
+// Browser bundlers might not have path or __dirname. Make DEFAULT_FONT optional
8
+let DEFAULT_FONT = '';
9
+try {
10
+ DEFAULT_FONT = require('path').join(__dirname, '../fonts/ipag.ttf'); // eslint-disable-line global-require
11
+} catch (e) {
12
+ DEFAULT_FONT = '';
13
+}
14
15
// Private method
16
0 commit comments