teambit / bit.envs

DEPRECATED - Bit compilers and testers were moved to https://github.com/teambit/envs
https://bit.dev/bit/envs
Other
23 stars 9 forks source link

Latest react-typescript compiler cannot build an svg image #58

Open seed-of-apricot opened 5 years ago

seed-of-apricot commented 5 years ago

I have tried react-typescript@3.0.21 and got this error. images/logo is an svg image that is imported by atoms/brand-logo.

C:\Users\[user]\src\[user]\[project]\[sub_project]>bit tag --all 0.1.0
successfully installed the bit.envs/compilers/react-typescript@3.0.21 compiler
error: bit failed to build atoms/brand-logo with the following exception:
error: bit failed to build images/logo with the following exception:
Command failed with exit code 2 (Unknown system error -2): C:\Users\[user]\src\[user]\[project]\[sub_project]\.git\bit\components\compilers\react-typescript\bit.envs\3.0.21\components\.dependencies\compilers\typescript\bit.envs\3.0.25\node_modules\typescript\bin\tsc -d
Error: Command failed with exit code 2 (Unknown system error -2): C:\Users\[user]\src\[user]\[project]\[sub_project]\.git\bit\components\compilers\react-typescript\bit.envs\3.0.21\components\.dependencies\compilers\typescript\bit.envs\3.0.25\node_modules\typescript\bin\tsc -d   
    at makeError (C:\Users\[user]\src\[user]\[project]\[sub_project]\.git\bit\components\compilers\react-typescript\bit.envs\3.0.21\components\.dependencies\compilers\typescript\bit.envs\3.0.25\node_modules\execa\lib\error.js:58:11)
    at handlePromise (C:\Users\[user]\src\[user]\[project]\[sub_project]\.git\bit\components\compilers\react-typescript\bit.envs\3.0.21\components\.dependencies\compilers\typescript\bit.envs\3.0.25\node_modules\execa\index.js:112:26)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

ExternalBuildErrors
    at C:\Users\[user]\AppData\Roaming\nvm\v12.4.0\node_modules\bit-bin\dist\consumer\component-ops\build-component.js:707:19

I have also tested react-typescript@3.0.1 and it worked.

C:\Users\[user]\src\[user]\[project]\[sub_project]>bit tag --all 0.1.0
successfully installed the bit.envs/compilers/react-typescript@3.0.1 compiler
(node:26828) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability 
issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.  
11 component(s) tagged
(use "bit export [collection]" to push these components to a remote")
(use "bit untag" to unstage versions)

new components
(first version for components)
... // new component list

Is this a bug or an expected error? I will post additional info if needed.

JoshK2 commented 5 years ago

We are aware of this issue and working on it. We changed the underline implementation of the base typescript recently and it's still not stable enough. You can use v3.0.1 which not using the new base typescriptץ

qballer commented 5 years ago

Hi @seed-of-apricot , I published a few updates of the compiler. Can you test that and let me know if there is still an issue. Can you try 3.0.22? If the issue persist it would be helpful to provide some kind of repo which reconstructs the base issue.

seed-of-apricot commented 5 years ago

Thank you for your cooperation, I'm actually traveling with limited resources until Thursday so let me see once I'm back home.

seed-of-apricot commented 5 years ago

@JoshK2 @qballer Sorry for late response. I have tried 3.0.22 and 3.0.25, and in short it didn't work perfectly.

First, the build succeeded for the svg component itself.

C:\Users\[user]\src\[user]\[project]\[sub_project]>bit tag images/logo
1 component(s) tagged
(use "bit export [collection]" to push these components to a remote")
(use "bit untag" to unstage versions)

new components
(first version for components)
     > images/logo@0.0.1

However, a component that depends on that svg does not pass the build.

C:\Users\[user]\src\[user]\[project]\[sub_project]>bit tag atoms/brand-logo
/ building componentsBrandLogo.tsx:3:18 - error TS2307: Cannot find module '@assets/images/logo/index.svg'.

3 import logo from '@assets/images/logo/index.svg';
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error.

error: bit failed to build atoms/brand-logo with the following exception:
Command failed with exit code 2 (Unknown system error -2): C:\Users\[user]\src\[user]\[project]\[sub_project]\.git\bit\components\compilers\react-typescript\bit.envs\3.0.22\components\.dependencies\compilers\typescript\bit.envs\3.0.28\node_modules\typescript\bin\tsc -d
Error: Command failed with exit code 2 (Unknown system error -2): C:\Users\[user]\src\[user]\[project]\[sub_project]\.git\bit\components\compilers\react-typescript\bit.envs\3.0.22\components\.dependencies\compilers\typescript\bit.envs\3.0.28\node_modules\typescript\bin\tsc -d
    at makeError (C:\Users\[user]\src\[user]\[project]\[sub_project]\.git\bit\components\compilers\react-typescript\bit.envs\3.0.22\components\.dependencies\compilers\typescript\bit.envs\3.0.28\node_modules\execa\lib\error.js:58:11)
    at handlePromise (C:\Users\[user]\src\[user]\[project]\[sub_project]\.git\bit\components\compilers\react-typescript\bit.envs\3.0.22\components\.dependencies\compilers\typescript\bit.envs\3.0.28\node_modules\execa\index.js:112:26)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

Note that it works with 3.0.1.

qballer commented 5 years ago

Hi @seed-of-apricot, can you provide a repo to reconstruct your issue. Or an example to component content?

seed-of-apricot commented 5 years ago

@qballer An example component I uploaded can be found here.
This is one of the dependents of this component. If it's not enough I will make a minimal repro.