FinishedHim

How to setup Typescript properly for Client-Side

Recommended Posts

Hi,

I searched for this problem a while but it seems like I´m the only one with this question.

I´m using Webstorm as IDE and Typescript as language on Server and Client-Side. On Client side I have the probblem that the Client doesnt find my modules because of the wrong require-paths. If i change the path to the path rage needs to have, my IDE throws errors on compilation.

For example my gamemode is named "script" and inside it I have the files "index.js" and "test.js". For rage I have to add the root folder to include the "test.js" from "index.js" with something like that: "require('./script/test')... If i do so my IDE cries because it wants the require like that: "require('./test')" .

I saw some Gamemodes that use just the relative path without the rootfolder prefix. How is this possible, this would be the perfect solution.

Is it possible to ignore the "/script" part in requires over the tsconfig.json file?

I hope you can help me 

 

Edit: I´m searching for a prettier way than just add a ts-ignore statement, if it exists

Edited by FinishedHim

Share this post


Link to post
Share on other sites

Am I getting that right that the target is not to have multiple gamemodes in the client-packages folder?

So i just can break my folder structure one level down and i have everything i want?

Share this post


Link to post
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.