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
[Bug]: Puppeteer not working properly as a bundle #8044
Comments
How does esbuild handle require.resolve? In 13.3.2 we solved an issue for webpack which didn't always configure __dirname properly so it works in webpack now. I wonder if esbuild can handle require.resolve similarly? |
Please give 13.4.0 a try. That should work well for both esbuild and webpack. |
I'll test it thanks. |
Parcel is giving me an error that it's not running in a module context even though my package.json has a type: module. /var/home/reesericci/js/node/r1scraper/node_modules/puppeteer/lib/esm/puppeteer/node.js:16 SyntaxError: Cannot use import statement outside a module |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
I think this was likely to have been fixed with the recent fixes and changes. Please command if the issue is still happening. |
still seeing this with test.ts: import puppeteer from 'puppeteer';
const browser = await puppeteer.launch({headless: 'new'});
const page = await browser.newPage();
await page.goto('https://www.google.com');
await browser.close(); build with: esbuild test.ts \
--bundle \
--minify=false \
--sourcemap \
--splitting \
--outdir=dist \
--external:typescript \
--platform=node \
--out-extension:.js=.mjs \
--format=esm \
--banner:js=\"const require=(await import('node:module')).createRequire(import.meta.url);const __filename=(await import('node:url')).fileURLToPath(import.meta.url);const __dirname=(await import('node:path')).dirname(__filename)\" then run: node --enable-source-maps dist/test.mjs results:
|
Bug description
The last version of Puppeteer is not working using
esbuild
bundler (Probably any bundler).Steps to reproduce the problem:
Reproduce on GitHub:
Reproduce Locally
expected local behaviour:
The app should run with no problems when you run "dev" script and "start" script.
In advance thanks for your work on this package and the attention to this issue report.
good energy 👍👍👍👍
Puppeteer version
13.3.2
Node.js version
17.3.1
npm version
8.3.0
What operating system are you seeing the problem on?
Linux, macOS
Relevant log output
The text was updated successfully, but these errors were encountered: