I have small vue.js app.
I want to import specific json based on user input.
import content from "@/posts/posts/" + new URL(location.href).searchParams.get('id') + ".json";
Every time I do this I get an error on 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"
But when I try to import it with one string like this:
import content from "@/posts/posts/0.json";
it works.