cli icon indicating copy to clipboard operation
cli copied to clipboard

`percy` `--config` fails silently when `.js` config attempts an `import` or `require`

Open aresnick opened this issue 3 years ago • 1 comments

The problem

I'd like to import breakpoints for use in widths in .percy.js. The following .percy.js does not work (i.e. the widths are not respected, and instead the defaults of 375 and 1280 are used) when used via percy snapshot --config=.percy.js snapshots.js, but does when the require line is removed (similarly with the equivalent import).

const { breakpoints } = require("./site-data.js");

module.exports = {
  version: 2,
  snapshot: {
    widths: [378, 1283],
    minHeight: 1024,
    percyCSS: "",
  },
  discovery: {
    networkIdleTimeout: 100,
  },
  static: {
    cleanUrls: false,
  },
  upload: {
    files: "**/*.{png,jpg,jpeg}",
    ignore: "",
    stripExtensions: false,
  },
};

Environment

  • Node version: v14.18.3 (npm v6.14.15)
  • @percy/cli version: @percy/cli 1.0.0-beta.76
  • Version of Percy SDK you’re using: N/A
  • If needed, a build or snapshot ID: https://percy.io/be8d462e/powderhouse.org/builds/16394515
  • OS version: macOS 12.1 (21C52)
  • Type of shell command-line [interface]: zsh

Details

None beyond the above.

Debug logs

It's not clear whether/how the Percy CLI has a --debug or --verbose option.

Code to reproduce issue

None beyond the above.

aresnick avatar Mar 09 '22 20:03 aresnick

This issue is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Mar 29 '22 19:03 github-actions[bot]