Skip to content

Bug: resolve the exact path of bundles #2940

@dongnguyenvie

Description

@dongnguyenvie

Terms

Description

What's wrong?

The code splitting is not working in production. when i try to chunk file. it in dev env. but when build for prod. it's not work. because the path is wrong

What have you tried?

I try to set public path
.setPublicPath('wp-content/themes/my-theme/public/')
then I use yarn build
then I replace public path in "entrypoints.json" manually. it work in prod

Steps To Reproduce

  1. code splitting and import into app.js
  2. yarn build
  3. http://domain/

Expected Behavior

Resolve correct path of bundle

Actual Behavior

image

Relevant Log Output

(index):633 GET http://xxxxx.test/94.46e9e8.js net::ERR_ABORTED 404 (Not Found)
u.l @ (index):633
u.f.j @ (index):633
(anonymous) @ (index):633
u.e @ (index):633
675 @ app.104bdb.js:1
u @ (index):633
n @ app.104bdb.js:1
(anonymous) @ app.104bdb.js:1
n @ (index):633
(anonymous) @ app.104bdb.js:1
(index):633 Uncaught (in promise) ChunkLoadError: Loading chunk 94 failed.
(error: http://xxxxx.test/94.46e9e8.js)
    at Object.u.f.j ((index):633:2188)
    at (index):633:866
    at Array.reduce (<anonymous>)
    at Function.u.e ((index):633:831)
    at Object.675 (app.104bdb.js:1:261)
    at u ((index):633:138)
    at n (app.104bdb.js:1:1068)
    at app.104bdb.js:1:1078
    at n ((index):633:2651)
    at app.104bdb.js:1:64
u.f.j @ (index):633
(anonymous) @ (index):633
u.e @ (index):633
675 @ app.104bdb.js:1
u @ (index):633
n @ app.104bdb.js:1
(anonymous) @ app.104bdb.js:1
n @ (index):633
(anonymous) @ app.104bdb.js:1
Promise.then (async)
675 @ app.104bdb.js:1
u @ (index):633
n @ app.104bdb.js:1
(anonymous) @ app.104bdb.js:1
n @ (index):633
(anonymous) @ app.104bdb.js:1
(index):633 GET http://xxxxx.test/951.ba9c7b.js net::ERR_ABORTED 404 (Not Found)
u.l @ (index):633
u.f.j @ (index):633
(anonymous) @ (index):633
u.e @ (index):633
675 @ app.104bdb.js:1
u @ (index):633
n @ app.104bdb.js:1
(anonymous) @ app.104bdb.js:1
n @ (index):633
(anonymous) @ app.104bdb.js:1
(index):633 Uncaught (in promise) ChunkLoadError: Loading chunk 951 failed.
(error: http://xxxxx.test/951.ba9c7b.js)
    at Object.u.f.j ((index):633:2188)
    at (index):633:866
    at Array.reduce (<anonymous>)
    at Function.u.e ((index):633:831)
    at Object.675 (app.104bdb.js:1:319)
    at u ((index):633:138)
    at n (app.104bdb.js:1:1068)
    at app.104bdb.js:1:1078
    at n ((index):633:2651)
    at app.104bdb.js:1:64
u.f.j @ (index):633
(anonymous) @ (index):633
u.e @ (index):633
675 @ app.104bdb.js:1
u @ (index):633
n @ app.104bdb.js:1
(anonymous) @ app.104bdb.js:1
n @ (index):633
(anonymous) @ app.104bdb.js:1
Promise.then (async)
675 @ app.104bdb.js:1
u @ (index):633
n @ app.104bdb.js:1
(anonymous) @ app.104bdb.js:1
n @ (index):633
(anonymous) @ app.104bdb.js:1
(index):633 GET http://xxxxx.test/791.2a2363.js net::ERR_ABORTED 404 (Not Found)
u.l @ (index):633
u.f.j @ (index):633
(anonymous) @ (index):633
u.e @ (index):633
675 @ app.104bdb.js:1
u @ (index):633
n @ app.104bdb.js:1
(anonymous) @ app.104bdb.js:1
n @ (index):633
(anonymous) @ app.104bdb.js:1
(index):633 Uncaught (in promise) ChunkLoadError: Loading chunk 791 failed.
(error: http://xxxxx.test/791.2a2363.js)
    at Object.u.f.j ((index):633:2188)
    at (index):633:866
    at Array.reduce (<anonymous>)
    at Function.u.e ((index):633:831)
    at Object.675 (app.104bdb.js:1:289)
    at u ((index):633:138)
    at n (app.104bdb.js:1:1068)
    at app.104bdb.js:1:1078
    at n ((index):633:2651)
    at app.104bdb.js:1:64
u.f.j @ (index):633
(anonymous) @ (index):633
u.e @ (index):633
675 @ app.104bdb.js:1
u @ (index):633
n @ app.104bdb.js:1
(anonymous) @ app.104bdb.js:1
n @ (index):633
(anonymous) @ app.104bdb.js:1
Promise.then (async)
675 @ app.104bdb.js:1
u @ (index):633
n @ app.104bdb.js:1
(anonymous) @ app.104bdb.js:1
n @ (index):633
(anonymous) @ app.104bdb.js:1

Versions

mac catalina 10.15.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions