Jump to content

[ERROR] Compile Clientside Code from Typescript to Javascript.


Nibyc

Recommended Posts

Hello there :),

i need your help.Β 
i have a Problem with the compiling from typescript to Javascript.Β 

This is the Error:
https://prnt.sc/21akv8o

This is my folder structure. I want to compile my ts code to js with the structure which is defined in my developing folder

πŸ“¦RPServer
 ┣ πŸ“‚developing
 ┃ ┣ πŸ“‚client
 ┃ ┃ ┣ πŸ“‚package
 ┃ ┃ ┃ ┣ πŸ“‚gui
 ┃ ┃ ┃ ┃ ┣ πŸ“‚connection
 ┃ ┃ ┃ ┃ ┃ ┣ πŸ“œindex.ts
 ┃ ┃ ┃ ┃ ┃ β”— πŸ“œplayerConnected.ts
 ┃ ┃ ┃ ┃ β”—πŸ“œindex.ts
 ┃ ┃ ┃ β”—πŸ“œindex.ts
 ┃ ┃ β”—πŸ“œtsconfig.json
 ┃ ┣ πŸ“‚server
 ┣ πŸ“‚server-files
 ┃ ┣ πŸ“‚client_packages
 ┃ ┃ ┣ πŸ“‚gui
 ┃ ┃ ┃ ┣ πŸ“‚connection
 ┃ ┃ ┃ ┃ ┣ πŸ“œindex.js
 ┃ ┃ ┃ ┃ β”— πŸ“œplayerConnected.js
 ┃ ┃ ┃ β”—πŸ“œindex.js
 ┃ ┃ β”—πŸ“œindex.js
 ┣ πŸ“œpackage.json
 β”— πŸ“œpackage-lock.json
 

this is my tsconfig.json

{
  "compilerOptions": {
    "strict": true,
    "baseUrl": "./",
    "target": "es2015",
    "module": "commonjs",
    "allowJs": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "removeComments": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "types" : ["node", "ragemp-c"],
    "outDir": "../../server-files/client_packages/",       
  },
  "include": [
    "**/*"
  ]
}

developing/client/package/gui/connection/playerConnected.ts

mp.events.add('playerReady', () => {
    mp.gui.chat.push('Player connected!');
});

developing/client/package/gui/connection/index.ts

import './playerConnected';

developing/client/package/gui/index.ts

import'./connection/index';

developing/client/package/index.ts

/**
 * Loaded on client initialization
 */

import './gui/index';

Β 

This is compiling to following code:Β 

server-files/client_packages/gui/connection/playerConnected.js

"use strict";
mp.events.add('playerReady', () => {
    mp.gui.chat.push('Player connected!');
});

server-files/client_packages/gui/connection/index.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./playerConnected");

server-files/client_packages/gui/index.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./connection/index");

server-files/client_packages/index.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./gui/index");


i really don't know what the Problem is.. i tried sereval things.. changed imports etc. but nothing works.

If someone here knows whats the Problem please let me know :)

Thanks alot!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...