iTwin / presentation

Monorepo for iTwin.js Presentation Library
https://www.itwinjs.org/presentation/
MIT License
4 stars 0 forks source link

The ModelTree widget display error after electron packaged #338

Closed fatalstar closed 10 months ago

fatalstar commented 10 months ago

I try to pack itwin electron viewer demo by using 'electron-packager'. Set the config like this : (because there are some .dll files) asar: { unpackDir: node_modules/@bentley/imodeljs-native/**, },

The model tree is normal when in development, but error after packaged.

image

I wonder if this problem is related to asar configuration (maybe presentation), and how to fix it.

Thanks!

grigasp commented 10 months ago

Hi @fatalstar, thanks for the report. Can you provide the following details please?

fatalstar commented 10 months ago

Hi, @grigasp Thanks for reply!

  1. As the picture, every node of ModelTree display 'Not spceified'.
  2. After packed code, and I get an exe file. This error will display when the exe running.
  3. I'm using @itwin/presentation-backend": "4.1.3"

The ModeTree display normal before create package, but get error after that, so I guess there is something missed in package config?

grigasp commented 10 months ago

Thanks. I wouldn't call invalid labels an error, but, in any case, they're all "Not specified" because the @itwin/presentation-backend package can't find its assets.

Before version 4.2 the package used to deliver an assets directory. In most situations we were able to find its location automatically, in some others apps could configure it using PresentationManagerProps.presentationAssetsRoot prop when initializing Presentation.

However, we noticed that this is an issue with Electron, because we weren't able to find those assets in the ASAR package. This issue was resolved with the 4.2 release.

fatalstar commented 10 months ago

Hi, @grigasp I updated itwin to 4.2, but it still can not find assets in ASAR, ( either asar.unpack ), I'm using "electron": "^24.6.5" and "electron-packager": "^17.1.2".

Thanks for the answer, so I could use presentationAssetsRoot config to fix this issue. It display right labels now. Thank you very much!