Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider removing manual modularization #438

Open
shamrin opened this issue Feb 6, 2021 · 3 comments
Open

Consider removing manual modularization #438

shamrin opened this issue Feb 6, 2021 · 3 comments

Comments

@shamrin
Copy link

shamrin commented Feb 6, 2021

The generated code in sql-wasm.js mentions Emscripten issue: emscripten-core/emscripten#5820.

This issue was fixed in PR emscripten-core/emscripten#10697 and released as version 13.9.16 in May 2020.

I think removing manual modularization will simplify sql.js build process.

@lovasoa
Copy link
Member

lovasoa commented Feb 6, 2021

Yes, this could be nice, and simplify our old build process. Are you interested in making a PR ?

@Taytay
Copy link
Contributor

Taytay commented Mar 21, 2021

I'm thrilled to hear that this was fixed in Emscripten directly. I've been out of this project for a while, but am dipping my toes back in and can take a look if no one beats me to it.

@rhashimoto
Copy link

I don't know how the bug was originally triggered, but I tried adding -s MODULARIZE=1 to the emcc flags, changed the output filename to end with .mjs (to output an ES6 module which I prefer), and removed the custom bundling.

Then to load the module in my page I did:

import initSqlJs from '../dist/sql-idb-wasm.mjs';
initSqlJs().then(async SQL => {
  ...

It seems to work. I'm using emsdk 2.0.16. Again, I don't know if I'm exercising the problem path.

twoxfh added a commit to twoxfh/sql.js that referenced this issue Mar 3, 2022
This makes an ES6 Module for SqlJs, not sure how it affects the other generated files. Based on Roy's comment sql-js#438 (comment)

import initSqlJs from 'URL TO /sql-wasm.mjs';
const SQL =  await initSqlJs({
  // Required to load the wasm binary asynchronously. Of course, you can host it wherever you want
  // You can omit locateFile completely when running in node
  locateFile: file => `URL TO /sql-wasm.wasm`
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants