Skip to content

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

Closed
@famanoder

Description

@famanoder

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

Activity

gaearon

gaearon commented on Jun 5, 2017

@gaearon
Contributor

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(/* ... */)
locked and limited conversation to collaborators on Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gaearon@famanoder

        Issue actions

          why I can't use bundle-loader like this? · Issue #2477 · facebook/create-react-app