https://github.com/robintw/antipodes-webpack
https://github.com/robintw/antipodes-webpack
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/robintw/antipodes-webpack
- Owner: robintw
- Created: 2018-04-09T18:58:04.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-10T08:43:00.000Z (about 8 years ago)
- Last Synced: 2025-04-01T15:57:17.918Z (about 1 year ago)
- Language: JavaScript
- Size: 72.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This repo demonstrates the problem I'm having with webpack. My aim is to use the module turf (http://turfjs.org/) to do some geographic analysis in the browser.
I started by following the webpack Getting Started guide (https://webpack.js.org/guides/getting-started/) and creating `src/index.js` and `dist/index.html`. I import `_` from `lodash` and use it to do a simple string join. This all works.
I then try and extend this to do a simple demonstration using turf. In the turf getting started guide (http://turfjs.org/getting-started) it says that you can include individual turf modules in a webpack-based project. So, I installed `@turf/distance` and `@turf/helpers` and added some code using them to `index.js`. The relevant docs are at http://turfjs.org/docs#distance and http://turfjs.org/docs#point.
When running `npx webpack` I get the following errors:
```
ERROR in ./node_modules/@turf/invariant/index.mjs
59:34-42 Can't import the named export 'isNumber' from non EcmaScript module (only default export is available)
@ ./node_modules/@turf/invariant/index.mjs
@ ./node_modules/@turf/distance/index.js
@ ./src/index.js
ERROR in ./node_modules/@turf/invariant/index.mjs
59:62-70 Can't import the named export 'isNumber' from non EcmaScript module (only default export is available)
@ ./node_modules/@turf/invariant/index.mjs
@ ./node_modules/@turf/distance/index.js
@ ./src/index.js
```