Create-react-app: why I can't use bundle-loader like this?

Created on 5 Jun 2017  路  1Comment  路  Source: facebook/create-react-app

import LazyLogin from 'bundle-loader?lazy&name=[name]!./views/Login.js';

when I use bundle-loader like this ,some errors occured ! I had found some way and couldn't solve it .
I need some help ,and what should I do ?

Unexpected '!' in 'bundle-loader?lazy&name=[name]!./views/Login.js'. Do not use import syntax to configure webpack loaders import/no-webpack-loader-syntax

Most helpful comment

Webpack loaders are not supported by Create React App.

Moreover, you don鈥檛 need bundle-loader to implement lazy loading.
It is already supported out of the box with dynamic import().

Please check out this guide on code splitting:
http://serverless-stack.com/chapters/code-splitting-in-create-react-app.html

And this doc:
https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting

import('./views/Login.js').then(/* ... */)

>All comments

Webpack loaders are not supported by Create React App.

Moreover, you don鈥檛 need bundle-loader to implement lazy loading.
It is already supported out of the box with dynamic import().

Please check out this guide on code splitting:
http://serverless-stack.com/chapters/code-splitting-in-create-react-app.html

And this doc:
https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting

import('./views/Login.js').then(/* ... */)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

stopachka picture stopachka  路  3Comments

Aranir picture Aranir  路  3Comments

dualcnhq picture dualcnhq  路  3Comments

rdamian3 picture rdamian3  路  3Comments

AlexeyRyashencev picture AlexeyRyashencev  路  3Comments