Skip to content

Commit

Permalink
node env cjs/mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Jan 31, 2023
1 parent 95049f3 commit 1a97d33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export default [
plugins,
external: [
'jsdom',
'jsdom/lib/jsdom/living/generated/utils',
'jsdom/lib/jsdom/utils',
'jsdom/lib/jsdom/living/generated/utils.js',
'jsdom/lib/jsdom/utils.js',
'canvas',
],
},
Expand Down
11 changes: 7 additions & 4 deletions src/env/node.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/* eslint-disable no-restricted-globals */
import { JSDOM } from 'jsdom';
import { implForWrapper as jsdomImplForWrapper } from 'jsdom/lib/jsdom/living/generated/utils';
import { Canvas as nodeCanvas } from 'jsdom/lib/jsdom/utils';
import utils1 from 'jsdom/lib/jsdom/living/generated/utils.js';
import utils2 from 'jsdom/lib/jsdom/utils.js';
import { config } from '../config';
import { setEnv } from './index';
import { TCopyPasteData, TFabricEnv } from './types';

const { implForWrapper: jsdomImplForWrapper } = utils1;
const { Canvas: nodeCanvas } = utils2;

const copyPasteData: TCopyPasteData = {};

const virtualWindow = new JSDOM(
const { window: virtualWindow } = new JSDOM(
decodeURIComponent(
'%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E'
),
Expand All @@ -18,7 +21,7 @@ const virtualWindow = new JSDOM(
},
resources: 'usable',
}
).window;
);

const fabricDocument = virtualWindow.document;
const fabricWindow = virtualWindow;
Expand Down

0 comments on commit 1a97d33

Please sign in to comment.