Home > Blockchain >  Eosjs compiler error
Eosjs compiler error

Time:09-15

I hope on the web page access eos service, according to the introduction of the eos's official website, download via NPM eosjs, command is as follows:
NPM init - y
NPM install eosjs @ beta
Found eosjs is written in typescript, if be used on the front end, needs to be compiled into js, because found eosjs provides webpack configuration, so ready to compile by webpack typescript, command is as follows:
NPM install webpack webpack cli typescript ts - loader
,/node_modules/bin/webpack -- config./webpack. Debug. Js
The result error is as follows:
 
Hash: 15328 fb466988ab8b5f9
Version: webpack 4.28.3
Time: 96 ms
Built at: 12/30/2018 1:12:50 AM
Asset Size Chunks Chunk Names
Eosjs - API - debug. Js 8.85 KiB eosjs_api [emitted] eosjs_api
Eosjs jsonrpc - debug. Js 10.9 KiB eosjs_jsonrpc [emitted] eosjs_jsonrpc
Eosjs jssig - debug. Js 8.9 KiB eosjs_jssig [emitted] eosjs_jssig
Entrypoint eosjs_api=eosjs - API - debug. Js
Entrypoint eosjs_jsonrpc=eosjs - jsonrpc - debug. Js
Entrypoint eosjs_jssig=eosjs - jssig - debug. Js
[./SRC/eosjs - API. Ts] 310 bytes {eosjs_api} [built] [failed] [1 error]
[the./SRC/eosjs - jsonrpc. Ts] 277 bytes {eosjs_jsonrpc} [built] [failed] [1 error]
[the./SRC/eosjs - jssig. Ts] 354 bytes {eosjs_jssig} [built] [failed] [1 error]
[the./SRC/eosjs - rpcerror. Ts] 277 bytes {eosjs_jsonrpc} [built] [failed] [1 error]
[./SRC/RPC - web. Ts] 122 bytes {eosjs_jsonrpc} [built]

The ERROR in the./SRC/eosjs - jsonrpc. Ts after
The Module parse failed: Unexpected token (he)
You may need an appropriate loader to handle this file type.
| import RpcError from "./eosjs - RpcError ";
|
The function arrayToHex (data: Uint8Array) {
| let the result="";
| the for (const x of data) {
@./SRC/RPC - web. Ts 1-0-38-40 4:0

The ERROR in the./SRC/eosjs - jssig. Ts so
The Module parse failed: Unexpected token (so)
You may need an appropriate loader to handle this file type.
|
|/* * Signs the transactions using the in - process private keys */
Export the default class JsSignatureProvider implements SignatureProvider {
|/* * map public to private keys */
| public keys=new Map (a);

The ERROR in./SRC/eosjs - API.
ts canopyThe Module parse failed: Unexpected token (harry)
You may need an appropriate loader to handle this file type.
| export default class Api {
|/Issues RPC calls */* *
Public RPC: JsonRpc;
|
|/* * Get subset of ` availableKeys ` men to meet authorities in a ` transac tion ` */

The ERROR in the./SRC/eosjs - rpcerror. Ts as
The Module parse failed: Unexpected token (even)
You may need an appropriate loader to handle this file type.
| export default class RpcError extends the Error {
|/* * the Detailed error information */
Public json: any;
|
| constructor (json: any) {
@./SRC/RPC - web. Ts 2-0-40 4-0-40

Look the compiler doesn't recognize the typescript code, where is my configuration is wrong?
  • Related