seek-oss / sku

Front-end development toolkit

Home Page:https://seek-oss.github.io/sku

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with loadable

shavo007 opened this issue · comments

Code splitting by route, get test failure

Summary of all failing tests
 FAIL  src/App/App.spec.js
  ● Test suite failed to run

    /Users/slee/projects/adv-account-management-ui/node_modules/sku/@loadable/component/index.ts:3
    import loadable, { loadableReady } from '@loadable/component';
           ^^^^^^^^

    SyntaxError: Unexpected identifier

      16 | import UnhandledErrorPage from './UnhandledErrorPage';
      17 | import { trackOnce } from 'src/utils/trackError';
    > 18 | import loadable from 'sku/@loadable/component';
         | ^
      19 | 
      20 | import {
      21 |   selectIsPendingActivation,

      at ScriptTransformer._transformAndBuildScript (node_modules/jest/node_modules/@jest/transform/build/ScriptTransformer.js:471:17)
      at Object.<anonymous> (src/App/App.js:18:1)

sku version 8.5.0

sample usage in App.js


import loadable from 'sku/@loadable/component';



// code splitting by route
);
const LoadableNoMatchPage = loadable(() =>
  import(/* webpackChunkName: "nomatch-page"*/ './NoMatchPage'),
);


     <Switch>
                <Route component={LoadableNoMatchPage} />
              </Switch>

it works without sku prefix.

although #355 was going to change this behaviour but never got merged.