Skip to content

Commit 4358253

Browse files
committed
webpack: Add sql-wasm.js to CopyWebpackPlugin to fix 404 error
- Root cause: sql-wasm.js file exists in node_modules but not copied to build output - Error coming from sql-wasm.js:159 indicates missing file on deployed site - Added sql-wasm.js to CopyWebpackPlugin patterns to copy it to build output - Updated debug memory with root cause analysis
1 parent 7c1da42 commit 4358253

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

app/web/webpack.config.d/sqljs-config.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@ config.resolve = {
1212
}
1313
};
1414

15-
// Add CopyWebpackPlugin to copy SQL.js WebAssembly binary
16-
const CopyWebpackPlugin = require('copy-webpack-plugin');
17-
config.plugins.push(
18-
new CopyWebpackPlugin({
19-
patterns: [
20-
{
21-
from: '../../node_modules/sql.js/dist/sql-wasm.wasm',
22-
to: 'sql-wasm.wasm'
23-
}
24-
]
25-
})
26-
);
15+
// Add CopyWebpackPlugin to copy SQL.js WebAssembly binary and JavaScript file
16+
const CopyWebpackPlugin = require('copy-webpack-plugin');
17+
config.plugins.push(
18+
new CopyWebpackPlugin({
19+
patterns: [
20+
{
21+
from: '../../node_modules/sql.js/dist/sql-wasm.wasm',
22+
to: 'sql-wasm.wasm'
23+
},
24+
{
25+
from: '../../node_modules/sql.js/dist/sql-wasm.js',
26+
to: 'sql-wasm.js'
27+
}
28+
]
29+
})
30+
);
2731

2832
// Add webpack plugin to modify SQL.js WASM loading at the source level
2933
class SQLJsWasmFixPlugin {

docs/sqljs_debug_memory.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515
- `981.js` was fixed but there's another file (`870.js`) still trying to load from root path
1616
- Found the same pattern in `870.js`: `locateFile:t=>".././sql-wasm.wasm"`
1717
- Webpack plugin is working but not catching all files
18+
- **ROOT CAUSE FOUND**: Error is coming from `sql-wasm.js:159` - this is a separate `sql-wasm.js` file that's being loaded dynamically
19+
- The `sql-wasm.js` file exists in node_modules but is NOT being copied to build output
20+
- **SOLUTION**: Add `sql-wasm.js` to CopyWebpackPlugin to copy it to build output
1821

1922
## Files Found
2023
-`981.js` - Fixed (path changed from `.././sql-wasm.wasm` to `./sql-wasm.wasm`)
21-
-`870.js` - Still has `.././sql-wasm.wasm` pattern
24+
-`870.js` - Still has `.././sql-wasm.wasm` pattern (webpack plugin not processing distribution files)
25+
-`sql-wasm.js` - Missing from build output, needs to be copied by webpack plugin
2226

2327
## Next Steps
2428
1. Update webpack plugin to catch all chunk files including 870.js

0 commit comments

Comments
 (0)