share an array between files #4227
aiUser1001
started this conversation in
General
Replies: 1 comment 4 replies
-
if you're trying to use a variable in both |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've tried everything I can think of and it still doesn't work. I've created an array in createContextHandlers.js and I exported it module.exports = { myArray, createContextHandlers }. I did the same in the index.js file in the same directory. I would like to read myArray in Markdown.tsx. I did set the following in tsconfig.json:
"allowJs": true,
"outDir": "./dist",
I set the paths in both tsconfig and vite.config. I've tried importing the array in Markdown.tsx, both using the ES and commonJS styles but nothing works, I only get Uncaught ReferenceError: require is not defined. Thanks for any help.
Beta Was this translation helpful? Give feedback.
All reactions