Skip to content

Adding --extractErrors to build throws errors #912

@andrewmcgivery

Description

@andrewmcgivery

Current Behavior

I'm currently trying to add the --extractErrors flag to builds of Redux Toolkit (https://github.com/reduxjs/redux-toolkit) and without making ANY changes, just adding that flag, it gives some pretty unhelpful errors. I'm not sure what information to provide because I'm a bit lost myself on what is causing this other than "babel issue".

> tsdx build --format cjs,esm,umd --name redux-toolkit --extractErrors && api-extractor run --local

✓ Creating entry file 3.8 secs
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
(at position 1 plugin) SyntaxError: Unexpected token, expected , (47:4)

at undefined:47:4
SyntaxError: Unexpected token, expected , (47:4)
    at Parser.pp$5.raise (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:4454:13)
    at Parser.pp.unexpected (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:1761:8)
    at Parser.pp.expect (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:1749:33)
    at Parser.pp$8.flowParseTypeParameterDeclaration (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:5322:12)
    at Parser.pp$8.flowParseInterfaceish (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:5191:32)
    at Parser.pp$8.flowParseInterface (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:5229:8)
    at Parser.parseExportDeclaration (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:6036:21)
    at Parser.pp$1.parseExport (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:2654:29)
    at Parser.parseExport (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:6000:20)
    at Parser.pp$1.parseStatement (E:\Source\redux-toolkit\node_modules\babylon\lib\index.js:1884:74)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @reduxjs/toolkit@1.4.0 build: `tsdx build --format cjs,esm,umd --name redux-toolkit --extractErrors && api-extractor run --local`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @reduxjs/toolkit@1.4.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Andrew\AppData\Roaming\npm-cache\_logs\2020-10-27T01_44_02_027Z-debug.log

Expected behavior

Shouldn't explode. :) Worth mentioning, ErrorDev, ErrorProd, and codes.json files are created before it craps out. Even if I have invarant being used in the codebase, codes.json is empty (just {}), however.

Suggested solution(s)

I have no idea. I've been trying to dig into this on my side but I've hit a dead end which is why I'm reaching out!

Additional context

Reproducing is really simple... clone Redux Toolkit, add the flag to the build script, and watch it error.

Your environment

System:
    OS: Windows 10 10.0.18363
    CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
    Memory: 8.15 GB / 15.95 GB
  Binaries:
    Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.4 - ~\AppData\Roaming\npm\npm.CMD
  Browsers:
    Chrome: 86.0.4240.111
    Edge: Spartan (44.18362.449.0)
    Internet Explorer: 11.0.18362.1
  npmPackages:
    tsdx: ^0.11.0 => 0.11.0
    typescript: ^3.8.2 => 3.8.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: outdatedThis is not up-to-date with the current version

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions