3

My file structure looks as follows:

root
  src
    test.ts
    template.xlsx
  dist
    // compiled js source ...

In test.ts, I try to reference the spreadsheet template as follows:

path.join(__dirname, "template.xlsx");

But it is searching in path/to/root/dist instead of looking in path/to/root/src. What's the best way to access my file?

1
  • you are doing it right, but you need to make sure that template.xlsx is also placed into dist Commented Jun 4, 2019 at 6:38

1 Answer 1

1

If you want to access to /src from /dist you could navigate there like this:

path.join(__dirname + "../src", "template.xlsx");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.