umijs / umi-examples

examples for umi.js
316 stars 279 forks source link

Cannot destructure ROUTES_MODIFIER in runtime-routes-update #41

Closed xcesiv closed 1 year ago

xcesiv commented 5 years ago

Cannot destructure ROUTES_MODIFIER in runtime-routes-update

Problem

Throws error saying ROUTES_MODIFER cannot be destructed because it's null/undefined.

runtime-routes-update-error

Potential Fix?

I solved this by changing: https://github.com/umijs/umi-examples/blob/7e9d5bc3344ecf564aa2bc451e1444ec159bf465/runtime-routes-update/updateRoutes.plugin.js#L5

to: const { service: { paths }, placeholder: { ROUTES_MODIFIER } = {} } = api;

If there is a better solution to this please advise. Otherwise will gladly open a pull request