-
Notifications
You must be signed in to change notification settings - Fork 188
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
[FEATURE REQUEST] Allow JavaScript files to be linked without dead-code elimination #1465
Comments
|
Hard to say, here's the error I get:
And here is the formatted JS file : The file is created with webpack, and uses a very low preset (es5) so I don't think there are any imports/exports. |
Could you verify that #1466 fixes your underlying issue ? I could identify 3 issues:
|
Thanks for the quick reply!
Who displays me, if I do
So I guess I'm in a good state. However, if I relaunch
Still the same issue using the formatted code. EDIT:
It works! (With formatted code, when the code isn't formatted, it's minified, the error is the same, but that's a detail). Thanks a lot! |
Here is an example of a minified version of the stubs : https://gist.github.com/xvw/e8b29b71758e77223ec894cf31c70937 |
I pushed 2 more fixes in #1466. Can you check again with the minified version ? |
It seems working. Thanks a lot for the quick fix! |
Hello !
I'm perfectly aware that dead-code elimination is a desirable feature, but in some cases it can be problematic.
For example, as part of a project (Yourbones), we depend on libraries available via NPM, so we use Webpack to build a JavaScript file which exports the objects we need in our OCaml library, to apply the various polyfills so that in the end we only have a single file, in this case,
beacon_stubs.js
which we can link with the dune directivejavascript_file ...
.Unfortunately, the code produced by Webpack cannot be interpreted by JSOO's JavaScript parser.
In the development context, it's enough to include the generated file in the HTML before including the file compiled by JSOO. However, in the context of distributing a library, I think it could be useful to be able to link Javascript files in the runtime, without trying to parse them and extract export information. This would make it possible to work relatively well with the JavaScript ecosystem, which requires files to be pre-bundled when targeting the browser.
The text was updated successfully, but these errors were encountered: