Skip to content
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: wranglerjs-compat-webpack-plugin Cannot find module './impl/format' #3764

Closed
tiagonbotelho opened this issue Aug 15, 2023 · 5 comments
Labels
bug Something that isn't working

Comments

@tiagonbotelho
Copy link

tiagonbotelho commented Aug 15, 2023

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

2.2.4 [Wrangler], 0.0.8 [wranglerjs-compat-webpack-plugin] 4.46.0 [Webpack], 4.10.0 [Webpack CLI]

What version of Node are you using?

16.10.2

What operating system are you using?

Mac

Describe the Bug

I'm currently following the guide to migrate a project using wrangler v1 to v2, specifically the webpack section.

However, when running npm run build, I get the following error logs which you can find below.

I've tried looking for this specific error, but couldn't find anything relevant. From reading the error it seems like there could be a missing module that is being imported 🤔

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

$ npm run build                                                

> [email protected] build
> webpack

[webpack-cli] Failed to load '/XXX/webpack.config.js' config
[webpack-cli] Error: Cannot find module './impl/format'
Require stack:
- /XXX/node_modules/wranglerjs-compat-webpack-plugin/lib/index.js
- /XXX/webpack.config.js
- XXX/node_modules/webpack-cli/lib/webpack-cli.js
- XXX/node_modules/webpack-cli/lib/bootstrap.js
- XXX/node_modules/webpack-cli/bin/cli.js
- XXX/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1021:15)
    at Function.Module._load (node:internal/modules/cjs/loader:866:27)
    at Module.require (node:internal/modules/cjs/loader:1093:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at XXX/node_modules/wranglerjs-compat-webpack-plugin/lib/index.js:5425:25
    at XXX/node_modules/wranglerjs-compat-webpack-plugin/lib/index.js:5415:17
    at ../../node_modules/jsonc-parser/lib/umd/main.js (XXX/node_modules/wranglerjs-compat-webpack-plugin/lib/index.js:5421:7)
    at __require (XXX/node_modules/wranglerjs-compat-webpack-plugin/lib/index.js:8:50)
    at Object.<anonymous> (XXX/node_modules/wranglerjs-compat-webpack-plugin/lib/index.js:28146:35)
    at Module._compile (node:internal/modules/cjs/loader:1191:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'XXX/node_modules/wranglerjs-compat-webpack-plugin/lib/index.js',
    'XXX/webpack.config.js',
    'XXX/node_modules/webpack-cli/lib/webpack-cli.js',
    'XXX/node_modules/webpack-cli/lib/bootstrap.js',
    'XXX/node_modules/webpack-cli/bin/cli.js',
    'XXX/node_modules/webpack/bin/webpack.js'
  ]
}
@tiagonbotelho tiagonbotelho added the bug Something that isn't working label Aug 15, 2023
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Aug 15, 2023
@samuelcolvin
Copy link

Any update on this? I'm getting the same error.

I also got an error Error: Cannot find module 'esbuild' which was solved by installing esbuild which wranglerjs-compat-webpack-plugin apparently relies on, but doesn't have as a dependency.

@samuelcolvin
Copy link

This seems to be caused by evanw/esbuild#1619 - esbuild is having problems with the UMD exports of jsonc-parser, but I'm not at all clear how to fix it.

I'm seeing this exact error on samuelcolvin/smokeshow#27, see this build error. Any help would be much appreciated.

@samuelcolvin
Copy link

From a discussion on discord it seems that wranglerjs-compat-webpack-plugin doesn't work with wrangler v3 😞.

@penalosa
Copy link
Contributor

wranglerjs-compat-webpack-plugin was a stopgap solution to help with migrating between Wrangler 1 and 2, but it's no longer something that receives a lot of attention. Usually we'd recommend using Wrangler's built-in bundling, and if that doesn't work for some reason using a Custom Build (which can call out to Webpack if necessary in your setup)

@mrbbot
Copy link
Contributor

mrbbot commented Jan 8, 2024

Hey! 👋 We haven't heard from you in a while, so we’re going to close this issue for now. If this is still a problem, please feel free to open a new issue referencing this one. Please be sure to include an updated summary and any additional requested details, followup, or context and we will revisit and investigate further. Thanks!

@mrbbot mrbbot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
@github-project-automation github-project-automation bot moved this from Untriaged to Done in workers-sdk Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
None yet
Development

No branches or pull requests

4 participants