mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
f230722ff0
This patch removes all dynamic requires in Puppeteer. This should make it much simpler to bundle puppeteer/puppeteer-core packages. We used dynamic requires in a few places in lib/: - BrowserFetcher was choosing between `http` and `https` based on some runtime value. This was easy to fix with explicit `require`. - BrowserFetcher and Launcher needed to know project root to store chromium revisions and to read package name and chromium revision from package.json. (projectRoot value would be different in node6). Instead of doing a backwards logic to infer these variables, we now pass them directly from `//index.js`. With this patch, I was able to bundle Puppeteer using browserify and the following config in `package.json`: ```json "browser": { "./lib/BrowserFetcher.js": false, "ws": "./lib/BrowserWebSocket", "fs": false, "child_process": false, "rimraf": false, "readline": false } ``` (where `lib/BrowserWebSocket.js` is a courtesy of @Janpot from https://github.com/GoogleChrome/puppeteer/pull/2374/) And command: ```sh $ browserify -r puppeteer:./index.js > ppweb.js ``` References #2119 |
||
---|---|---|
.. | ||
.eslintrc.js | ||
Browser.js | ||
BrowserFetcher.js | ||
Connection.js | ||
Coverage.js | ||
Dialog.js | ||
EmulationManager.js | ||
Errors.js | ||
ExecutionContext.js | ||
externs.d.ts | ||
FrameManager.js | ||
helper.js | ||
Input.js | ||
Launcher.js | ||
Multimap.js | ||
NavigatorWatcher.js | ||
NetworkManager.js | ||
Page.js | ||
Pipe.js | ||
Puppeteer.js | ||
Target.js | ||
TaskQueue.js | ||
Tracing.js | ||
USKeyboardLayout.js | ||
Worker.js |