I’m trying to use the Level database abstraction and the IndexedDB-based Level-down for the browser variant of my app.
It converts everything in a byte array, as stated in the documentation:
Like other implementations of abstract-level, browser-level has first-class support of binary keys and values, using either Uint8Array or Buffer. In order to sort string and binary keys the same way as other databases, browser-level internally converts data to a Uint8Array before passing them to IndexedDB. If you have no need to work with Buffer keys or values, you can choose to omit the buffer shim from a JavaScript bundle (through configuration of Webpack, Browserify or other bundlers).
I’m having hard time debugging my app as I can’t browse the database when everything is binary.
How do I tell Webpack 5.91.0 to exclude the “buffer shim” so that the browser-lever
doesn’t make the unneeded conversion as it promises in the docs?
This is my webpack config:
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default {
entry: './src/la.js',
output: {
filename: 'laio.js',
path: path.resolve(__dirname, 'dist'),
library: "la"
}
};
The internet search makes me think everybody understands how to do it in Webpack 5, but I’m missing something.