pouchdb: WebPack related error: LevelUp package.json produces errors
When packaging PouchDB in an app with WebPack, the following error gets output. The current PouchDB npm release doesn’t build because of a bug recently fixed (see #3287). The current github master allows it to proceed but it then hits the error below.
Unless I’m mistaken LevelUP shouldn’t be required in the client? Can it be left out of the package altogether in a similar manor to the fix for #3287 ?
Is it ok to just add levelup: false
to the browser
section of package.json
or should it be replaced with a browser compatible module?
ERROR in ./~/pouchdb/~/levelup/package.json
Module parse failed: /Volumes/Files/Projects/Harvest/app2/node_modules/pouchdb/node_modules/levelup/package.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
| "name": "levelup",
| "description": "Fast & simple storage - a Node.js-style LevelDB wrapper",
| "version": "0.18.6",
@ ./~/pouchdb/~/levelup/lib/util.js 102:30-56
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 23 (16 by maintainers)
Commits related to this issue
- (#3319) - explicitly set leveldown and levelup to false in browser env — committed to svnlto/pouchdb by svnlto 9 years ago
- (#3319) - set leveldown to false to fix webpack Webpack does not like that `leveldown` is trying to use `fs`. We can harmlessly set it to `false` in the package.json. For `levelup`, the issue is tha... — committed to pouchdb/pouchdb by nolanlawson 9 years ago
- (#3319) - set leveldown to false to fix webpack Webpack does not like that `leveldown` is trying to use `fs`. We can harmlessly set it to `false` in the package.json. For `levelup`, the issue is tha... — committed to pouchdb/pouchdb by nolanlawson 9 years ago
- (#3319) - set leveldown to false to fix webpack Webpack does not like that `leveldown` is trying to use `fs`. We can harmlessly set it to `false` in the package.json. For `levelup`, the issue is tha... — committed to pouchdb/pouchdb by nolanlawson 9 years ago
- Note webpack configuration requirement https://github.com/pouchdb/pouchdb/issues/3319#issuecomment-124501093 — committed to dashed/pouchdb by dashed 9 years ago
- (#3319) - Note webpack configuration requirement https://github.com/pouchdb/pouchdb/issues/3319#issuecomment-124501093 — committed to pouchdb/pouchdb by dashed 9 years ago
For posterity, webpack users, do:
Those steps get it working for me, but it still seems to be including a ton of stuff it doesn’t need.
generates the same warning @timcash mentioned above, but shaves ~300K off the unminified bundle for me.
Here’s what needs to be done (in webpack’s config), to get it working with pouchdb:
also, you should work from master, it contains the additional fix.
perhaps that might be something we’d want to look at as well.