jlongster / absurd-sql

sqlite3 in ur indexeddb (hopefully a better backend soon)
MIT License
4.15k stars 101 forks source link

can't resolve fs #27

Closed Debdut closed 2 years ago

Debdut commented 2 years ago

I'm using Webpack and somehow it can't resolve 'fs'. Do I need a polyfill?

Note: I'm trying to use it in background js in Chrome Extension

ERROR in ./node_modules/@jlongster/sql.js/dist/sql-wasm.js 93:81-94
Module not found: Error: Can't resolve 'fs' in './node_modules/@jlongster/sql.js/dist'
resolve 'fs' in './node_modules/@jlongster/sql.js/dist'
  Parsed request is a module
  using description file: ./node_modules/@jlongster/sql.js/package.json (relative path: ./dist)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      ./node_modules/@jlongster/sql.js/dist/node_modules doesn't exist or is not a directory
      ./node_modules/@jlongster/sql.js/node_modules doesn't exist or is not a directory
      ./node_modules/@jlongster/node_modules doesn't exist or is not a directory
      ./node_modules/node_modules doesn't exist or is not a directory
      looking for modules in ./node_modules
        single file module
          using description file: ./package.json (relative path: ./node_modules/fs)
            no extension
 @ ./src/worker/index.ts 43:31-59
Debdut commented 2 years ago

Solved with using 👇in Webpack config.resolve

fallback: {
      crypto: false,
      path: false,
      fs: false
}