Skip to content

Import JSON file in build folder instead js file #8242

Answered by sapphi-red
ngocducdim asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to load dist/cbs.json, you need to use fetch not import.

const res = await fetch('/cbs.json')
const data = await res.json()

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@kissu
Comment options

@sapphi-red
Comment options

@syahbes
Comment options

@XDreamist
Comment options

@gupingan
Comment options

Answer selected by ngocducdim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
6 participants
Converted from issue

This discussion was converted from issue #8241 on May 20, 2022 12:07.