Skip to content

BlockNote v0.15.2 Incompatibility with Vite Module Federation: 404 Errors on Dynamic Chunk Loading #1330

Closed
@GersonDantas

Description

@GersonDantas

Bug Report

Describe the bug
When upgrading BlockNote from version v0.15.1 to v0.15.2, dynamic chunks fail to load properly in an environment that uses Vite Module Federation. The result is multiple 404 Not Found errors when the remote module attempts to fetch the chunks (index-[hash].js).
Captura de Tela 2024-12-18 às 11 52 24

What puzzles me most is that this error only occurs when the remote module is loaded for the first time.


To Reproduce

  1. Setup a Vite Module Federation project with the following remote configuration:

    federation({
      name: 'frontend',
      filename: 'remoteEntry.js',
      remotes: {
        blockEditor:  'http://localhost:3478/assets/remoteEntry.js',
      },
    });
  2. In the consumer project, dynamically import a BlockNote component:

    const blockNotesMount = await import('blockEditor/BlockNotes');
  3. Run both the remote (form-builder) and host (frontend) applications.

  4. Observe the console logs and network tab in the browser.

Expected behavior
The chunks (index-[hash].js) should be loaded properly without returning 404 Not Found errors.

Actual behavior
404 errors occur when the remote tries to fetch the dynamically generated chunks.

Error Example in Console:

GET http://localhost:8080/assets/index-B0aq7g5R.js 404 (Not Found)

Misc

  • Node version: 20.15.0
  • Package manager: npm 10.7.0
  • Browser: Chrome 131
  • BlockNote version: v0.15.2
  • Vite: 6.0.3
  • Vite Plugin Federation: @originjs/vite-plugin-federation v1.3.6

Additional Context

The issue does not occur in version v0.15.1 of BlockNote. It appears that changes in v0.15.2 (notably PRs #943 and #945) related to drag-and-drop and module management have affected compatibility with Vite's dynamic imports.

Downgrading to v0.15.1 resolves the issue temporarily:

npm install @blocknote/[email protected] @blocknote/[email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions