Skip to content

Commit

Permalink
fix: Fixed injecting webpack (#1783) (close #1778)
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Mar 28, 2024
1 parent 59db1a5 commit 79f1f2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/tools/browser.ts
Expand Up @@ -127,7 +127,7 @@ export async function preparePage(page: playwright.Page) {
}, 500);
});

page.on('domcontentloaded', async (page) => {
page.on('load', async (page) => {
await page.addScriptTag({
url: `${URL}dist/wppconnect-wa.js`,
});
Expand Down
5 changes: 3 additions & 2 deletions src/webpack/index.ts
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import { compare } from 'compare-versions';
import Debug from 'debug';

import { internalEv } from '../eventEmitter';
Expand Down Expand Up @@ -159,8 +160,8 @@ export function injectLoader(): void {
const chunkName = 'webpackChunkwhatsapp_web_client';

const chunk = global[chunkName] || [];
if (typeof global[chunkName] === 'undefined') {
global[chunkName] = chunk;
if (compare(self.Debug.VERSION, '2.3000.0', '>=')) {
Object.defineProperty(global, chunkName, chunk);
} else {
loaderType = 'webpack';
}
Expand Down

0 comments on commit 79f1f2e

Please sign in to comment.