1

I'm a game that has text file levels.

You can require JSON files, I'd like to do the same with text.

const levels = [
  require("./levels/1.txt"),
  require("./levels/2.txt"),
  require("./levels/3.txt")
];
Lucien
  • 776
  • 3
  • 12
  • 40
  • 1
    Duplicate of [How can I import the text of a file into a variable in javascript during compilation using webpack?](https://stackoverflow.com/questions/52044410/how-can-i-import-the-text-of-a-file-into-a-variable-in-javascript-during-compila) – esqew Aug 31 '21 at 19:03

0 Answers0