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

Error: '__spreadArrays' is not exported by tslib occurs when npm run build #310

Open
Gr8tMiller opened this issue Sep 27, 2019 · 8 comments

Comments

@Gr8tMiller
Copy link

Gr8tMiller commented Sep 27, 2019

Hi, I got an error when npm run build, the message shown has nothing to do with my source code.

(!) Error when using sourcemap for reporting an error: Can't resolve original location of error.
src/Row.ts: (1:43)
[!] Error: '__spreadArrays' is not exported by tslib
https://rollupjs.org/guide/en#error-name-is-not-exported-by-module-
src/Row.ts (1:43)
1: import {Cell} from './Cell';
                                 ^
2: import {Table} from './Table';
3: import {Column} from './Column';
Error: '__spreadArrays' is not exported by tslib
    at error (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:3460:30)
    at Module.error (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:13350:9)
    at handleMissingExport (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:13040:21)
    at Module.traceVariable (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:13454:17)
    at ModuleScope.findVariable (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:12726:29)
    at FunctionScope.Scope.findVariable (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:4022:68)
    at Scope.findVariable (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:4022:68)
    at FunctionScope.Scope.findVariable (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:4022:68)
    at Scope.findVariable (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:4022:68)
    at Identifier$$1.bind (/Users/xxx/Workspace/projects/mytable/node_modules/rollup/dist/rollup.js:10111:40)

these are all modules I added in my project:

  "devDependencies": {
    // ...
    "rollup-plugin-less": "latest"
  },
  "dependencies": {
    "handsontable": "^6.2.2",
    "lodash": "^4.17.11",
    "nanobus": "^4.4.0",
    "uuid": "^3.3.2"
  }

the complete log is here

i would really appreciate it if you can help me.

@Gr8tMiller
Copy link
Author

my fault, adding

"importHelpers": true,

into tsconfig.json fix the problem.
refer https://www.typescriptlang.org/docs/handbook/compiler-options.html

@mjcc007
Copy link

mjcc007 commented Jan 19, 2020

I have the same problem! how did you resolved it?

@yiliang114
Copy link

the same problem

@GooGee
Copy link

GooGee commented Jun 14, 2020

update devDependencies

"rollup-plugin-typescript2": "^0.23.0"

@benxaamin
Copy link

Also you need to bump the rollup version in devDependencies

"rollup": "^0.68.0"

@SammyRobensParadise
Copy link

Just as an update was experiencing this same issue again with:

"rollup-plugin-typescript2": "^0.29.0",
"rollup": "^2.38.5",

Bumping to v0.30.0 solved the issue.

"rollup-plugin-typescript2": "^0.30.0"

@NadaTO
Copy link

NadaTO commented Nov 9, 2021

if you are working with react app in typescript you may just need to install "tslib" to solve the problem.
====> npm install tslib

tslib will then be added to your package.json

nim442 pushed a commit to unsplash/ts-imgix that referenced this issue Nov 12, 2021
nim442 pushed a commit to unsplash/ts-imgix that referenced this issue Nov 12, 2021
@jhunexjun
Copy link

Solved this by npm install tslib@latest --save

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

No branches or pull requests

8 participants