Issue Summary
I am using electron + sqlite3 + react + vite.
After installing sqlite3 and trying to rerun my application, now I have this error in my console.
This is my console look likes
✘ [ERROR] Could not resolve "mock-aws-s3"
node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:43:28:
43 │ const AWSMock = require('mock-aws-s3');
╵ ~~~~~~~~~~~~~
You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove
this error. You can also surround this "require" call with a try/catch block to handle this
failure at run-time instead of bundle-time.
✘ [ERROR] Could not resolve "aws-sdk"
node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:76:22:
76 │ const AWS = require('aws-sdk');
╵ ~~~~~~~~~
You can mark the path "aws-sdk" as external to exclude it from the bundle, which will remove this
error. You can also surround this "require" call with a try/catch block to handle this failure at
run-time instead of bundle-time.
✘ [ERROR] Could not resolve "nock"
node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:112:23:
112 │ const nock = require('nock');
╵ ~~~~~~
You can mark the path "nock" as external to exclude it from the bundle, which will remove this
error. You can also surround this "require" call with a try/catch block to handle this failure at
run-time instead of bundle-time.
/Users/gathsaraumesh/Development/My Work/Project/MyMarkDown/Project Files/app-ink-blend/node_modules/esbuild/lib/main.js:1636
let error = new Error(`${text}${summary}`);
^
Error: Build failed with 3 errors:
node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:43:28: ERROR: Could not resolve "mock-aws-s3"
node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:76:22: ERROR: Could not resolve "aws-sdk"
node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:112:23: ERROR: Could not resolve "nock"
at failureErrorWithLog (/Users/gathsaraumesh/Development/My Work/Project/MyMarkDown/Project Files/app-ink-blend/node_modules/esbuild/lib/main.js:1636:15)
at /Users/gathsaraumesh/Development/My Work/Project/MyMarkDown/Project Files/app-ink-blend/node_modules/esbuild/lib/main.js:1048:25
at /Users/gathsaraumesh/Development/My Work/Project/MyMarkDown/Project Files/app-ink-blend/node_modules/esbuild/lib/main.js:1512:9
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errors: [
{
detail: undefined,
id: '',
location: {
column: 28,
file: 'node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js',
length: 13,
line: 43,
lineText: " const AWSMock = require('mock-aws-s3');",
namespace: '',
suggestion: ''
},
notes: [
{
location: null,
text: 'You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.'
}
],
pluginName: '',
text: 'Could not resolve "mock-aws-s3"'
},
{
detail: undefined,
id: '',
location: {
column: 22,
file: 'node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js',
length: 9,
line: 76,
lineText: " const AWS = require('aws-sdk');",
namespace: '',
suggestion: ''
},
notes: [
{
location: null,
text: 'You can mark the path "aws-sdk" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.'
}
],
pluginName: '',
text: 'Could not resolve "aws-sdk"'
},
{
detail: undefined,
id: '',
location: {
column: 23,
file: 'node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js',
length: 6,
line: 112,
lineText: " const nock = require('nock');",
namespace: '',
suggestion: ''
},
notes: [
{
location: null,
text: 'You can mark the path "nock" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.'
}
],
pluginName: '',
text: 'Could not resolve "nock"'
}
],
warnings: []
}
This is my vite config
import{rmSync}from'node:fs'importpathfrom'node:path'import{defineConfig}from'vite'importreactfrom'@vitejs/plugin-react'importelectronfrom'vite-plugin-electron'importrendererfrom'vite-plugin-electron-renderer'importpkgfrom'./package.json'// https://vitejs.dev/config/exportdefaultdefineConfig(({ command })=>{rmSync('dist-electron',{recursive: true,force: true})constisServe=command==='serve'constisBuild=command==='build'constsourcemap=isServe||!!process.env.VSCODE_DEBUGreturn{resolve: {alias: {'@': path.join(__dirname,'src')},},plugins: [react(),electron([{// Main-Process entry file of the Electron App.entry: 'electron/main/index.ts',onstart(options){if(process.env.VSCODE_DEBUG){console.log(/* For `.vscode/.debug.script.mjs` */'[startup] Electron App')}else{options.startup()}},vite: {build: {
sourcemap,minify: isBuild,outDir: 'dist-electron/main',rollupOptions: {external: [...Object.keys('dependencies'inpkg ? pkg.dependencies : {}),'nock','mock-aws-s3','aws-sdk'],},},},},{entry: 'electron/preload/index.ts',onstart(options){// Notify the Renderer-Process to reload the page when the Preload-Scripts build is complete,// instead of restarting the entire Electron App.options.reload()},vite: {build: {sourcemap: sourcemap ? 'inline' : undefined,// #332minify: isBuild,outDir: 'dist-electron/preload',rollupOptions: {external: [...Object.keys('dependencies'inpkg ? pkg.dependencies : {}),'nock','mock-aws-s3','aws-sdk'],},},},}]),// Use Node.js API in the Renderer-processrenderer(),],server: process.env.VSCODE_DEBUG&&(()=>{consturl=newURL(pkg.debug.env.VITE_DEV_SERVER_URL)return{host: url.hostname,port: +url.port,}})(),clearScreen: false,}})``
### StepstoReproduce1.Installsqlite3usingnpm2.Trytorunnpmrundev
### Version5.1.6
### Node.jsVersion16.20.0
### Howdidyouinstallthelibrary?
Usingnpm
Issue Summary
I am using electron + sqlite3 + react + vite.
After installing sqlite3 and trying to rerun my application, now I have this error in my console.
This is my console look likes
This is my vite config