Ink: Does ink@next break almost all open source components?

Created on 10 Feb 2019  路  3Comments  路  Source: vadimdemedes/ink

Hey, i've checked out the new @next version, i'am wondering why a lot of components throwing an error when importing/using them:

/Users/michaelzoidl/Code/mvg-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/Users/michaelzoidl/Code/mvg-cli/node_modules/ink-spinner/dist/index.js:8:23)
    at Module._compile (internal/modules/cjs/loader.js:688:30)

If i understood everything right the problem is the move to the "normal" react, right? So every component which uses h is now broken?

I added a new branch (v2) in my project with the breaking case to reproduce this:
mvg-cli@v2

Just checkout the code snippet here [source]

import React, { Component } from 'react';
import { Box } from 'ink';

// If you remove the following line everything works like expected
import Spinner from 'ink-spinner';

const MVG = () => (
    <Box justifyContent='space-around'>
        <Box>X</Box>
        <Box>Y</Box>
    </Box>
);

export default MVG;

Reproduce Steps:

  1. Execute the start script which throws an error
npm start
  1. Remove the Spinner import in src/renderer.js:L5
  2. Excecute the start script again, now everything works like expected

My question
Since this is still the @next branch and not the published / stable branch it's more a question. If i want to use the @next version, do i've to give up the existing components? Like the ink-autocomplete or ink-spinner which are making this project very powerful.

Plus: Thanks for the awesome project and your time you invest in this project and in the issues :) The community needs people like you.

Most helpful comment

Maybe the v2 README should be updated to not list components that don't work with it anymore

All 3 comments

Yes given that the previous version didn't really use React, and this one does, I've found a lot of the older open source components don't work.

Maybe the v2 README should be updated to not list components that don't work with it anymore

That is correct, Ink 2 is a total rewrite from scratch. I've hit into a lot of roadblocks with Ink 1 and also realized I can't keep up with implementing all of React's latest features. Therefore I decided to use React itself :) I've migrated https://github.com/sindresorhus/emoj to v2 from v1 and it wasn't complicated, to be honest. I will write a migration guide before release though anyway.

Maybe the v2 README should be updated to not list components that don't work with it anymore

@KwanMan Agree, I will delete all incompatible components from the list before release. I'm also planning to migrate as much components as I can to Ink 2.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danikaze picture danikaze  路  5Comments

sindresorhus picture sindresorhus  路  7Comments

kutsan picture kutsan  路  7Comments

zkat picture zkat  路  3Comments

colinking picture colinking  路  6Comments