react-boilerplate/react-boilerplate-typescript

code splitting not work

scottsut opened this issue · 2 comments

Description

Page chunks code splitting not work in this typescript version

Steps to reproduce

clone the repo
npm install
npm start
visit the main page on chrome
check out the 'Sources' tab of chrome devtools and compare with react-boilerplate es version

Expected behavior
image

Screenshots
image

Versions

  • React-Boilerplate: 3.7.0
  • Node/NPM: 11.3.0 / 6.4.1
  • Browser: chrome 70.0.3538.110

Thanks for the heads up. After bit of digging I realized code splitting works with dynamic imports. But when compiling typescript module in commonjs, it kinda swallows it and afterwards webpack cannot see dynamic imports. Setting module='esnext' in tsconfig file solves it but now I am afraid to introduce more problems by changing to esnext from commonjs. For now, I will switch to esnext to enable code splitting.

I have a semi complex project that is built on this boilerplate (the reason I did the boilerplate actually). I'm gonna make the changes in that as well and see how the actual code is effected. Because this boilerplate is very simple and not really simulating the real use cases.

Any issue and help is extremely welcome :)

updated the master -> c198e83