sharetribe / ftw-daily

Sharetribe Flex Template for Web
Other
102 stars 944 forks source link

`sharetribe-scripts v6.0` and webpack5 optimization config #1545

Closed anh-dinh-jh closed 2 years ago

anh-dinh-jh commented 2 years ago

Describe the bug Got error: routeConfiguration is not a function

To Reproduce Steps to reproduce the behavior:

  1. Set async to any thunk in *.duck.js, for example: searchListings in SearchPage.duck.js
  2. Run yarn build or yarn dev-server
  3. See error
image

Expected behavior It should work normally as expected

Causes In CRA v5.0, FB had already deleted the splitChunks part. Then that part was added again in this PR, which causes an error. Because by using webpack5.0, whenever we put async before any thunk, the main file will be split into 2 files 210.*.js and main.*.js. The 210 is placed before the main and then loadable-server - requireEntrypoint could only get the first one (210) to build.

image

Possible solutions

Gnito commented 2 years ago

@anh-dinh-jh thanks for reporting this. We have had a vacation season, which caused some lag in responses on our part.

Anyway, we decided that it's better not to branch out from CRA too much since there's been a discussion of reintroducing this to CRA too. So, at this point, we decided to remove splitChunks again.

The fix is not yet fully released, but here's a candidate: https://github.com/sharetribe/create-react-app/pull/25

Gnito commented 2 years ago

Now the sharetribe-scripts v6.0.1 is released and taken into use on the master branch of FTW-daily.

Gnito commented 2 years ago

A new release is made with the updated sharetribe-scripts. I'm closing this issue.