For my Vue 3 project, I am trying to import a variable from a geojson file. However, when I use
import line from '@static/line.geojson'
, my page goes blank and it seems like Vue stops working.
If I use
import line from '@static/line.json'
, everything works fine. But, I need the geojson format for the rest of my code and I don't want to have two separate files with different extensions.
When I check the console, I see the error:
Uncaught SyntaxError: Unexpected token ':' (at line.geojson?import:2:10)
However, I know there are no errors in my file because I have used it in a Vue 2 project before without any issues.
Do you have any suggestions on how I can make 'line.geojson' work as a single file? I suspect that there might be a plugin I need to install but I am not sure which one.
This is the content of my 'line.geojson' file:
{
"type":"FeatureCollection",
"features":[
{
"type":"Feature",
"geometry":{
"type":"LineString",
"coordinates":[
[
2.373307391426136,
51.02186641516233
],
[
2.373339257074004,
51.02183268101012
],
// other points go here
]
},
"properties":{
"libelle":"Exploitée",
"geo_point_2d":[
51.0366532348,
2.41012862333
],
"mnemo":"EXPLOITE",
"rg_troncon":1,
"pk_fin_r":"311+500",
"pk_debut_r":"304+226",
"code_ligne":"300000"
}
}
]
}