box-content-preview icon indicating copy to clipboard operation
box-content-preview copied to clipboard

Break out at the moment of concatenate with other files

Open tayan-serna opened this issue 6 years ago • 1 comments

Environment:

  • Preview version: 1.29.0
  • Browser name and version: Google Chrome Versión 63.0.3239.132
  • Operating system and version: Windows 10

Steps to reproduce the problem:

  1. yarn run prod
  2. Concatenate with other JS files

What is the expected behavior? The box-content-preview library should work when is concatenated with another JS

What went wrong? At the moment when the library its concatenated with other ones show this message image

We're using your library in our project. In dev mode we're including all files listed and works just fine. But when we build for production, our process takes all JS and minifies and concat all files in a single one (builtApp.js) At this point, there is a check (https://github.com/box/box-content-preview/blob/master/src/lib/util.js#L603) for a <script... src=".../preview.js... that give us the error image

We're trying to sort this issue out by adding dependencies directly to our index.html pointing CDN but we would like to know why is that check, why do you expect to have it like that; maybe we can do some changes and minification would work on this project

tayan-serna avatar Feb 27 '18 14:02 tayan-serna

This is related to https://github.com/box/box-content-preview/issues/521. Currently we need the location of preview.js since we depend on third party assets (e.g. viewer assets like pdf.js, shaka-player.js, etc.). That combined with not wanting to load all third party assets together into one bundle (3D runtime assets are huge and aren't used at all if you're just viewing documents) lead us to an implementation where we expect a specific folder structure.

You may want to explore using https://github.com/box/box-ui-elements/blob/master/src/wrappers/ContentPreview.js in the short term while we figure out a long term solution.

tonyjin avatar Mar 01 '18 23:03 tonyjin