Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Unit tests are failing when using dynamic imports #359

@rolandjitsu

Description

@rolandjitsu

Is this a bug report?

Yes.

Can you also reproduce the problem with npm 4.x?

Yes.

Which terms did you search for in User Guide?

Unexpected token, Unexpected token import, dynamic import

Environment

  1. npm ls react-scripts-ts (if you haven’t ejected): 2.16.0
  2. node -v: 8.11.2
  3. npm -v: 5.6.0
  4. yarn --version (if you use Yarn): 1.7.0
  5. npm ls react-scripts-ts (if you haven’t ejected):

Then, specify:

  1. Operating system: macOS Sierra
  2. Browser and version (if relevant): Chrome

Steps to Reproduce

Go to cra-workspaces#dynamic-import:

  1. Clone repo
  2. Run yarn install from root
  3. Run yarn test

NOTE: Use yarn start to run the app and confirm it actually works.

Expected Behavior

Tests would pass without errors.

Actual Behavior

Tests are failing with:

/Users/rolandjitsu/Projects/cra-workspaces/apps/cra/src/app.tsx: Unexpected token (5:33)
        3 | import Loadable from 'react-loadable';
        4 | var DynamicComponent = Loadable({
      > 5 |     loader: function () { return import('./dynamic'); },
          |                                  ^
        6 |     loading: function () { return React.createElement("span", null, "Loading ..."); }
        7 | });
        8 | var App = /** @class */ (function (_super) {

Reproducible Demo

See cra-workspaces#dynamic-import and use instructions above to reproduce.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy