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

HTML bundler plugin fails to resolve source files #27831

Open
Mrtenz opened this issue Oct 14, 2024 · 0 comments
Open

HTML bundler plugin fails to resolve source files #27831

Mrtenz opened this issue Oct 14, 2024 · 0 comments
Labels
INVALID-ISSUE-TEMPLATE Issue's body doesn't match any issue template. webpack

Comments

@Mrtenz
Copy link
Member

Mrtenz commented Oct 14, 2024

Sometimes when running Webpack, the HTML bundler plugin fails to resolve certain source files, like scripts/load/background.ts, and scripts/load/ui.ts, even though these files exist. This seems to be due to some kind of caching issue, as it can be resolved when clearing node_modules/.cache, and only happens when the cache is already there.

I don't have a consistent way to reproduce it, but it sometimes happens after running yarn webpack -w --type flask, killing the process, and running the same command again.

🦊 Running development build…
ERROR in [initial]
 HTML Bundler Plugin  Failed to execute the function.
Source file: './app/background.html'
./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110
  throw new PluginException(message);
  ^

PluginException: 
 HTML Bundler Plugin  Can't resolve scripts/load/background.ts in the file background.html

    at resolveException (./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110:9)
    at Resolver.require (./node_modules/html-bundler-webpack-plugin/src/Plugin/Resolver.js:262:7)
    at ./app/background.html:1:132
    at Script.runInContext (node:vm:148:12)
    at VMScript.exec (./node_modules/html-bundler-webpack-plugin/src/Common/VMScript.js:39:27)
    at HtmlBundlerPlugin.renderModule (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:1314:27)
    at HtmlBundlerPlugin.renderManifest (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:889:26)
    at Hook.eval [as call] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at Compilation.getRenderManifest (./node_modules/webpack/lib/Compilation.js:4689:36)
    at ./node_modules/webpack/lib/Compilation.js:4709:22

ERROR in [initial]
 HTML Bundler Plugin  Failed to execute the function.
Source file: './app/home.html'
./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110
  throw new PluginException(message);
  ^

PluginException: 
 HTML Bundler Plugin  Can't resolve scripts/load/ui.ts in the file home.html

    at resolveException (./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110:9)
    at Resolver.require (./node_modules/html-bundler-webpack-plugin/src/Plugin/Resolver.js:262:7)
    at ./app/home.html:1:896
    at Script.runInContext (node:vm:148:12)
    at VMScript.exec (./node_modules/html-bundler-webpack-plugin/src/Common/VMScript.js:39:27)
    at HtmlBundlerPlugin.renderModule (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:1314:27)
    at HtmlBundlerPlugin.renderManifest (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:889:26)
    at Hook.eval [as call] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at Compilation.getRenderManifest (./node_modules/webpack/lib/Compilation.js:4689:36)
    at ./node_modules/webpack/lib/Compilation.js:4709:22

ERROR in [initial]
 HTML Bundler Plugin  Failed to execute the function.
Source file: './app/notification.html'
./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110
  throw new PluginException(message);
  ^

PluginException: 
 HTML Bundler Plugin  Can't resolve scripts/load/ui.ts in the file notification.html

    at resolveException (./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110:9)
    at Resolver.require (./node_modules/html-bundler-webpack-plugin/src/Plugin/Resolver.js:262:7)
    at ./app/notification.html:1:1383
    at Script.runInContext (node:vm:148:12)
    at VMScript.exec (./node_modules/html-bundler-webpack-plugin/src/Common/VMScript.js:39:27)
    at HtmlBundlerPlugin.renderModule (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:1314:27)
    at HtmlBundlerPlugin.renderManifest (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:889:26)
    at Hook.eval [as call] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at Compilation.getRenderManifest (./node_modules/webpack/lib/Compilation.js:4689:36)
    at ./node_modules/webpack/lib/Compilation.js:4709:22

ERROR in [initial]
 HTML Bundler Plugin  Failed to execute the function.
Source file: './app/popup.html'
./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110
  throw new PluginException(message);
  ^

PluginException: 
 HTML Bundler Plugin  Can't resolve scripts/load/ui.ts in the file popup.html

    at resolveException (./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110:9)
    at Resolver.require (./node_modules/html-bundler-webpack-plugin/src/Plugin/Resolver.js:262:7)
    at ./app/popup.html:1:960
    at Script.runInContext (node:vm:148:12)
    at VMScript.exec (./node_modules/html-bundler-webpack-plugin/src/Common/VMScript.js:39:27)
    at HtmlBundlerPlugin.renderModule (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:1314:27)
    at HtmlBundlerPlugin.renderManifest (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:889:26)
    at Hook.eval [as call] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at Compilation.getRenderManifest (./node_modules/webpack/lib/Compilation.js:4689:36)
    at ./node_modules/webpack/lib/Compilation.js:4709:22

ERROR in [initial]
 HTML Bundler Plugin  Failed to execute the function.
Source file: './app/trezor-usb-permissions.html'
./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110
  throw new PluginException(message);
  ^

PluginException: 
 HTML Bundler Plugin  Can't resolve vendor/trezor/usb-permissions.js in the file trezor-usb-permissions.html

    at resolveException (./node_modules/html-bundler-webpack-plugin/src/Plugin/Messages/Exception.js:110:9)
    at Resolver.require (./node_modules/html-bundler-webpack-plugin/src/Plugin/Resolver.js:262:7)
    at ./app/trezor-usb-permissions.html:1:1211
    at Script.runInContext (node:vm:148:12)
    at VMScript.exec (./node_modules/html-bundler-webpack-plugin/src/Common/VMScript.js:39:27)
    at HtmlBundlerPlugin.renderModule (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:1314:27)
    at HtmlBundlerPlugin.renderManifest (./node_modules/html-bundler-webpack-plugin/src/Plugin/AssetCompiler.js:889:26)
    at Hook.eval [as call] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at Compilation.getRenderManifest (./node_modules/webpack/lib/Compilation.js:4689:36)
    at ./node_modules/webpack/lib/Compilation.js:4709:22

🦊 MetaMask – development compiled with 5 errors
🦊 Watching for changes…
@Mrtenz Mrtenz added the webpack label Oct 14, 2024
@metamaskbot metamaskbot added the INVALID-ISSUE-TEMPLATE Issue's body doesn't match any issue template. label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INVALID-ISSUE-TEMPLATE Issue's body doesn't match any issue template. webpack
Projects
None yet
Development

No branches or pull requests

2 participants