Closed eklem closed 5 years ago
It may be as simple as referencing both scripts since search-index refer to indexeddb, but not sure if I need to browserify fake-indexeddb.
Hmm, seems indexedDBShim is already browserified, so I'll start with that.
Need to be webpack
or rollup
. I'll start with webpack. If search-index
could be a dependency and then altered so that indexedDBShim
is a sub dep it would only take one webpack
-step to get it working.
So, search-index
with the indexedDBShim
dependency, webpack'ed and running inside the XD plugin with one
const si = require('./search-index.js')
Here's how make it build automatically from package.json, and an example on how it can work from the xd-template-project.
Search-index test with working memdown example.
Try to webpack something like this:
import encode from 'encoding-down'
import fii from 'fergies-inverted-index'
import levelup from 'levelup'
import memdown from 'memdown'
import si from '../../dist/search-index.esm.js'
levelup(encode(memdown('myDB'), {
valueEncoding: 'json'
}), (err, store) => {
t.error(err)
db = si({
fii: fii({ store: store })
})
})
Got it working w/memdown in the browser
Error in XD because of eval
. Try the configuration file from one of the boilerplate projects.
https://github.com/pklaschka/xd-plugin-boilerplate/blob/master/webpack.config.js
Or just base it on the he boilerplate...
Need to use sval
to skip eval
use. Check out @kerrishotts pointers at Adobe XD Platform forums
Skip sval
and see if webpack with --devtool false
works. If so, I think it's a matter of setting up the Adobe XD plugin correctly.
Now, this needs to happen in XD plugin environment =)
Todo: