I am facing an issue with my small vue.js app.
My goal is to import a specific json file based on user input.
import content from "@/posts/posts/" + new URL(location.href).searchParams.get('id') + ".json";
Every time I attempt this, I encounter an error at the first plus sign.
Module parse failed: Unexpected token (7:37)
File was processed with these loaders:
* ./node_modules/vue-loader/dist/index.js
You may need an additional loader to handle the result of these loaders.
> import content from "@/posts/posts/" + new URL(location.href).searchParams.get('id') + ".json"
However, when I try importing it as one string like this:
import content from "@/posts/posts/0.json";
it works perfectly fine.