Skip to content

Commit

Permalink
🐛 Remove Dynamic import now that @percy/sdk-utils is commonjs
Browse files Browse the repository at this point in the history
We convereted `@percy/sdk-utils` to be ESM for 1.x, and this causes a lot of
various issues. That has since been reverted (it's back to commonjs) so we can
remove the dynamic import to fully remove any issues with ESM.
  • Loading branch information
Robdel12 committed May 9, 2022
1 parent 7116083 commit 35c3056
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Collect client and environment information
const utils = require('@percy/sdk-utils');
const sdkPkg = require('./package.json');
const puppeteerPkg = require('puppeteer/package.json');
const CLIENT_INFO = `${sdkPkg.name}/${sdkPkg.version}`;
const ENV_INFO = `${puppeteerPkg.name}/${puppeteerPkg.version}`;

// Take a DOM snapshot and post it to the snapshot endpoint
async function percySnapshot(page, name, options) {
let utils = await import('@percy/sdk-utils');

if (!page) throw new Error('A Puppeteer `page` object is required.');
if (!name) throw new Error('The `name` argument is required.');
if (!(await utils.isPercyEnabled())) return;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"puppeteer": ">=1"
},
"devDependencies": {
"@percy/core": "^1.0.0",
"@percy/core": "^1.1.2",
"@types/puppeteer": "^5.4.2",
"cross-env": "^7.0.2",
"eslint": "^7.18.0",
Expand Down
7 changes: 1 addition & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
cosmiconfig "^7.0.0"
yaml "^2.0.0"

"@percy/core@^1.0.0":
"@percy/core@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@percy/core/-/core-1.1.2.tgz#ab3cc069aada26d44dc9405631b60f09f6e444f1"
integrity sha512-xAhC+sXPMtLITgpGWCXcoABVMFS3PprlnNTj9yZ8eYK+XGf80DweNuBEzxpKKlQCiN/f5N3TCnIYUJUVO6M6eA==
Expand Down Expand Up @@ -321,11 +321,6 @@
resolved "https://registry.yarnpkg.com/@percy/env/-/env-1.1.2.tgz#73dfaa998da707d8881c669c11f02f1342cb44df"
integrity sha512-rXwzCyBGY2or1s7alod3RxWvI9vKKSzFInv6A26fCTYRAHjIInl4aKNzaDzUnFk35fDtLPxnIS/QkgK2L4yLyw==

"@percy/logger@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@percy/logger/-/logger-1.1.0.tgz#6bb5df0563d3566071f8b718e61f11a04c5a2722"
integrity sha512-bAlxBcdnViTpGQZtjs361vXSlaxEj6Zt4Wt1Mo7EdPwv/zya2cBpLFNNcRycWto4mdb5Qnpht+IPXf7RFXJ/nw==

"@percy/logger@1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@percy/logger/-/logger-1.1.2.tgz#3d49dcc6dfe717b36b09262dbef7c5caa5976285"
Expand Down

0 comments on commit 35c3056

Please sign in to comment.