1

I know one can read .json files from disk at compile time and use them in component like:

import * as configFromFile from './my-file.json';
...
let config = configFromFile;

Is there a way to load file in similar manner that is not .json, for example '.txt' or '.csv' file and initialise string variable with it's content?

2
  • 2
    No it's not possible because JSON means Javascript Object Notation so can be serialize/deserialize as a simple object literal not the case in front of '.csv' or 'txt'. Commented Jan 30, 2023 at 15:32
  • 1
    stackoverflow.com/questions/55714565/… Commented Jan 30, 2023 at 16:43

0

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.