-
Notifications
You must be signed in to change notification settings - Fork 491
Dynamic import not working #90
Comments
I have the same problem. I got it working by changing extension of the file containing my async component import statements from Looks like it's some configuration issue somewhere. Edit
Edit 2 This is what I had: import asyncComponent from './components/AsyncComponent';
const HomeScreen = asyncComponent(() => import ('screens/HomeScreen'));
export default [
// core routes
{
path: '/',
title: 'Home',
component: HomeScreen,
},
]; and this is what I now have (which works): import asyncComponent from './components/AsyncComponent';
export default [
// core routes
{
path: '/',
title: 'Home',
component: asyncComponent(() => import ('screens/HomeScreen')),
},
]; |
|
We have shipped 2.4 now, so this should be working. Please update so I can close this issue. |
Dynamic import works fine with the latest version. |
@nicolaserny can you open a PR with the necessary updates to tsconfig? |
It's worked for me without changing |
I've just created a basic example (create react app ts + react router). see attached document. 60.42 KB build/static/js/main.6b8b3e4e.js with esnext module: 60.53 KB (+106 B) build/static/js/main.1319f34a.js |
for me with "commonjs" module type import not worked |
I can confirm that it doesn't work with
|
@wmonk I'm still having this issue when running tests. Building and running the app works fine with dynamic imports, but not when I run Do you know why could this happen? |
Description
Dynamic import not split bundle into chunks.
Expected behavior
When using import('./component') inside some callback webpack should extract it to separate bundle.
Actual behavior
It always loads full bundle
Environment
npm ls react-scripts-ts
(if you haven’t ejected): react-scripts-ts@2.2.0node -v
: v6.11.0npm -v
: 3.10.10Then, specify:
The text was updated successfully, but these errors were encountered: