Closed spaasis closed 8 years ago
Hi. Hmm. Does it work if you explicitly use version 2.2.8
of osmtogeojson?
Uh, not exactly.. When I run webpack, there's a new error:
ERROR in ./~/osmtogeojson/polygon_features.json Module parse failed: /projectpath/node_modules/osmtogeojson/polygon_features.json Unexpected token (2:14) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (2:14) at Parser.pp$4.raise
Oh, I see what's going on: By default, webpack can't (or won't) require in raw json
files (which is done by the osm-polygon-features dependency of osmtogeojson).
If you add a json-loader
to your webpack config (e.g. { test: /\.json$/, loader: 'json-loader' },
), it should work fine.
It's not a bug on osmtogeojson's side. I'm not sure why webpack differs from the way node handles require
d json files, but I guess it's a deliberate thing. :confused:
Thanks a lot, everything (including the new version, for whatever reason..) seems to work now!
Hi,
I'm trying to get osm conversion to work, but I get the above error message with
let osmtogeojson = require('osmtogeojson');
I also tried
let osmtogeojson = require('osmtogeojson').default;
and to use babel-plugin-add-module-exports as per this SO thread, but nothing seems to work.Any further ideas on how to get this working? I'll happily provide more details