istextorbinary icon indicating copy to clipboard operation
istextorbinary copied to clipboard

create-react-app compatibility

Open bootrino opened this issue 3 years ago • 3 comments

Hello when I try to compile my TypeScript create react app project I get this:

Any ideas on how to solve?

thanks!

Failed to compile.

./node_modules/istextorbinary/edition-browsers/index.js 68:27
Module parse failed: Unexpected token (68:27)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   const textEncoding = 'utf8';
|   const binaryEncoding = 'binary';
>   const chunkLength = opts?.chunkLength ?? 24;
|   let chunkBegin = opts?.chunkBegin ?? 0; // Discover
|

bootrino avatar Sep 09 '21 01:09 bootrino

Did you get it working, if so what needed to be changed?

balupton avatar Oct 04 '21 21:10 balupton

[email protected] still not working with [email protected]

Failed to compile.

./node_modules/istextorbinary/edition-browsers/index.js 68:86
Module parse failed: Unexpected token (68:86)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   const textEncoding = 'utf8';
|   const binaryEncoding = 'binary';
>   const chunkLength = (opts === null || opts === void 0 ? void 0 : opts.chunkLength) ?? 24;
|   let chunkBegin = (opts === null || opts === void 0 ? void 0 : opts.chunkBegin) ?? 0; // Discover
|

andygock avatar Oct 05 '21 15:10 andygock

No I didn't get it working with TypeScript. Instead I had to import it as JavaScript into my TypeScript program.

Like this:

https://github.com/bootrino/reactoxide/blob/master/reactoxide/src/editor/textorbinary.js

Feels hacky - still hoping this will eventually support TypeScript and create react app.

ghost avatar Oct 06 '21 02:10 ghost