Skip to content

How to create a custom helper? #3625

Answered by melokki
melokki asked this question in Help
Mar 12, 2022 · 4 comments · 4 replies
Discussion options

You must be logged in to vote

I managed to make it working after I did the following:

In the root folder of the application I've created a new folder called helpers

in .adonisrc.json file I added this line:

"aliases": {
   ...
    "Helpers": "helpers"
  },

and in tsconfig.json I've added the following:

"compilerOptions": {
    "outDir": "build",
    "rootDir": "./",
    "sourceMap": true,
    "paths": {
      ...
      "Helpers/*": [
        "./helpers/*"
      ]
    },

Now I can make the import from Helpers and the code works just fine.
I don't know if it's the right way

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@melokki
Comment options

@RomainLanz
Comment options

@melokki
Comment options

Comment options

You must be logged in to vote
1 reply
@AbidKhairyAK
Comment options

Answer selected by melokki
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants