You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error:
[plugin: checkForNodeBuiltins] Detected a Node builtin module import while Node compatibility is disabled.
Add node_compat = true to your wrangler.toml file to enable Node compatibility.
But, I already had add the node_compat on wrangler.toml:
name = "api"compatibility_date = "2022-05-16"account_id = "1b5b99f85df2ff3830dfec7cb7cee2d9"workers_dev = true# Seems it's not workingnode_compat = true# --- STAGING ---
[env.staging]
main = "dist/bundle.js"
[dev]
# ip = "192.168.0.103"# @default `8787`
[env.staging.build]
command = "pnpm run build"
The file that throws the error:
src/index.ts
importpuppeteerfrom'puppeteer-extra'importStealthPluginfrom'puppeteer-extra-plugin-stealth'/**Line with that throws the error:PS. works only if comment this line*/puppeteer.use(StealthPlugin())addEventListener("fetch",(event)=>{//@ts-ignoreevent.respondWith(handleRequest(event.request));});//@ts-ignoreasyncfunctionhandleRequest(request){returnnewResponse("Hello worker!",{headers: {"content-type": "text/plain"},});}
I'm using with webpack:
package.json
"build": "webpack""dev": "wrangler dev -e staging --local"
webpack.config.cjs
module.exports={target: "webworker",mode: "development",devtool: 'cheap-module-source-map',entry: './src/index.ts',/* It throws with or without 'externals' and 'externalsPresets' */externals: [nodeExternals()],externalsPresets: {node: true},module: {rules: [{test: /\.tsx?$/,use: 'ts-loader',exclude: /node_modules/,},],},resolve: {extensions: ['.tsx','.ts','.js'],},output: {filename: 'bundle.js',path: path.resolve(__dirname,'dist'),}}
Thanks for this excellent issue report and reproduction. I was able to use it to reproduce the problem locally.
It is indeed a bug, since we are not correctly inheriting the node_compat value into named environments.
What version of
Wrangler
are you using?2.0.7
What operating system are you using?
Linux
Describe the Bug
Error:
[plugin: checkForNodeBuiltins] Detected a Node builtin module import while Node compatibility is disabled.
Add node_compat = true to your wrangler.toml file to enable Node compatibility.
But, I already had add the node_compat on wrangler.toml:
The file that throws the error:
src/index.ts
I'm using with webpack:
package.json
webpack.config.cjs
My repo with minimal code for error reproduction:
https://github.com/rauleite/issue
The text was updated successfully, but these errors were encountered: