-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packaging this library in a bundle to run using Cloudwatch synthetics. #74
Comments
I also had this problem. To unblock myself, copied the entry point in the library as shown below and set up Webpack to load the file with import {ElementHandle, EvaluateFn, JSHandle, Page} from 'puppeteer';
import waitForExpect from 'wait-for-expect';
import {
IConfigureOptions,
IQueryUtils,
IScopedQueryUtils,
} from 'pptr-testing-library/dist/typedefs';
import domLibraryAsString from 'raw-loader!pptr-testing-library/dom-testing-library.js'; But this library should handle this use case. I see a few ways to fix this:
@patrickhulce can you give some guidance here? |
Thanks for filing! Good questions.
|
A note of clarification for anyone else coming along this problem: The dom-testing-library.js source code should be treated as a string, NOT a JS module, since it needs to be passed exactly as-is to puppeteer by pptr-testing-library: pptr-testing-library/lib/index.ts Line 47 in 860106b
So make sure to either tell webpack not to run any sort of transformation on dom-testing-library.js (the raw-loader solution suggested above or similar is one way to do it), or just don't pass dom-testing-library.js through webpack at all -- copying dom-testing-library.js to the directory above your bundled code works fine (since the pptr-testing-library source does a file read on I think this is the least mind-bending way to get the bundling working, but it does depend on the file path specified in the pptr-testing-library implementation, so if you go this route I'd recommend locking the version of pptr-testing-library in your package.json. |
I'm currently looking to use this library to wrap cloudwatch synthetics use of puppeteer. To package the necessary code i'm using webpack to produce a bundle which will be provided to Cloudwatch Synthetics. The issue that i'm facing is that this underlying dependency:
pptr-testing-library/lib/index.ts
Line 8 in 860106b
is being loaded via readFileSync which webpack obviously does not pull in as part of its bundle. My question would be why is this the case? And would you have any recommendations as to packaging this library for use with in a lambda?
The text was updated successfully, but these errors were encountered: