Skip to content

Naming Mismatch Causes 404 Errors for Dynamically Imported Modules #506

@rodrigompv

Description

@rodrigompv

Current Behavior

After building the one web app client and serving it as static files, the web application functions, but the web console shows errors for every route or module preloading. The errors are as follows:

GET https://myapp.dev/assets/_88132734_vxrn_loader.js net::ERR_ABORTED 404 (Not Found)
Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: https://myapp.dev/assets/_88132734_vxrn_loader.js

Upon debugging, I discovered that this issue is caused by a naming mismatch. The actual files generated by the build process end with _preload.js, but the application attempts to fetch files with the suffix _vxrn_loader.js.

This mismatch occurs in the constants defined in the core code:

// this two should match
export const LOADER_JS_POSTFIX_UNCACHED = `_vxrn_loader.js`
export const PRELOAD_JS_POSTFIX = `_${CACHE_KEY}_preload.js`

As a result, the application fails to load the required modules, leading to runtime errors.

Expected Behavior

The suffixes used for dynamically imported module files should match. Specifically, the LOADER_JS_POSTFIX_UNCACHED constant should align with the PRELOAD_JS_POSTFIX constant so that the application correctly fetches the preloaded modules without causing 404 errors.

For example, if the build process generates files with the suffix _preload.js, the application should attempt to fetch files with the same suffix, ensuring seamless module loading.

One Version

1.1.451

Platform (Web, iOS, Android)

Web

Reproduction

- Create a new web application with multiple routes
- Build a simple UI that uses `<Link href="..." />` between the routes
- Run `one build` to get a production ui
- Serve the static files from a web server
- When using the application links, the console will show the errors

System Info

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions