Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why I can't use bundle-loader like this? #2477

Closed
famanoder opened this issue Jun 5, 2017 · 1 comment
Closed

why I can't use bundle-loader like this? #2477

famanoder opened this issue Jun 5, 2017 · 1 comment

Comments

@famanoder
Copy link

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

@gaearon
Copy link
Contributor

gaearon commented Jun 5, 2017

Webpack loaders are not supported by Create React App.

Moreover, you don’t 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(/* ... */)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants