Ice problem with webpack

juliuszcjuliuszc Member Juliusz ChoinskiOrganization: Northwestern UniversityProject: Use ice to communicate messages in electron/Java
Hello,

I'm trying to use Ice for an Electron app with webpack and I can't seem to figure out what is happening. Everything works fine until I try to install Ice and use it in the app. I keep getting this error message even though the file is there.
ERROR in ./~/ice/src/Ice/browser/Debug.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../Ice/ModuleRegistry in C:\Users\jchoinski\Documents\GitHub\e
lectron-vuejs-boilerplate\node_modules\ice\src\Ice\browser
 @ ./~/ice/src/Ice/browser/Debug.js 10:10-42

Is it possible to use Ice with Webpack?

I have used Ice with a NodeJs app before and I haven't ran into these problems.

Thank you,
Juliusz

Comments

  • juliuszcjuliuszc Member Juliusz ChoinskiOrganization: Northwestern UniversityProject: Use ice to communicate messages in electron/Java
    I should also add that before the error I get these warnings.
    45:76-83 require function is used in a way in which dependencies cannot be statically extracted
    @ ./~/ice/src/Ice/SliceChecksumDict.js 45:76-83
    
    WARNING in ./~/ice/src/Ice/Version.js
    Critical dependencies:
    93:76-83 require function is used in a way in which dependencies cannot be statically extracted
    @ ./~/ice/src/Ice/Version.js 93:76-83
    
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    We provide bundles to use in browser based applications in node_modules/ice/lib/ there is also a bower package, and CNDJS files see our download page for details https://zeroc.com/downloads/ice#javascript

    Our code base support both Browser client applications with WebSocket transport and Node client applications with TcpTransport files under browser/ folders are not intended to be used in NodeJS applications and some of the files in src/Ice are not included in the browser bundle.

    If you are interested in building Ice for JavaScript see https://github.com/zeroc-ice/ice/blo...nstructions.md

    We have a custom gulp task to build this bundle, https://github.com/zeroc-ice/ice/blo...gulp/bundle.js we haven't try webpack.

    Best Regards,
    Jose
  • janosjanos GermanyMember Janos VeresOrganization: feat.Me Networks, Inc.Project: An offline social interaction platform.

    Hi everonye,

    I was wondering if there's an update to this topic. I have also been experimenting including Ice via requires/imports but I can't get the bundles to work with browserify. I have no trouble with using the cdnjs Ice packages, but I would like to embed the slice2js generated code within my application code instead of having it lying around in plain sight.
    If I do that, the console just get's stuck on the second line this.Ice.__require:

    (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined,
     typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require,
     typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this));
    
    app.js:2277 Uncaught TypeError: Cannot read property 'Ice' of undefined
    

    If I strip away the surrounding function and the definitions from the beginning of the slice2js generated file, it seems to work, but that sound like a bad way of going about it.

    Do you have any suggestions how to proceed?

    Best regards
    Janos

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff

    Hi Janos,

    This is something we plan to do for the next major release, as seems to much of a change for a patch release.

    For now the best you can do is to use something similar to our bundle.js script mentioned above, that script use to generate the cdnjs bundles.

  • smandysmandy Member Andy SmithOrganization: Self EmployedProject: Learning Ice

    Hey,

    Just caught this thread searching for 'webpack'. Is the plan to make the javascript mapping webpack-friendly for Ice3.7 then? ( + if so is there a rough ballpark for the release of Ice 3.7 :-) ).

    Cheers,

    A.

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff

    With 3.7 we are introducing a new JavaScript global metada [["js:es6-module"]] this will instruct slice2js to generate es6 import/export statements.

    There is not yet any demo for this feature but you have an idea of how it works looking at this test https://github.com/zeroc-ice/ice/tree/master/js/test/Ice/import

    And here is how we build the bundle for the test using rollup, https://github.com/zeroc-ice/ice/blob/master/js/gulpfile.js#L184

    We have not yet a release date for 3.7

  • smandysmandy Member Andy SmithOrganization: Self EmployedProject: Learning Ice

    Great thanks,

    I'll probably be using webpack instead of rollup but I think provided the generator can be rigged to spit out the correct es6 import/export statements I don't think that'll be an issue :-)

    Cheers,

    A.

Sign In or Register to comment.