-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support ES6 import in uncompiled mode #466
Comments
"Compiled" in Closure means actually compiled. The Closure compiler not only minifies and concatenates, but also takes into account type information, enforces type-safety, and applies compiler optimizations. If you're installing from npm, the deps are already generated. The real issue seems to be that you're using ES6 imports instead of script tags, which is honestly not something we anticipated. As such, I'm renaming this issue as "Support ES6 import in uncompiled mode". I'm not sure how we would do this off-hand, but we will keep it in mind when we start planning our next major release. Thanks! |
You should be able to do this with webpack. Its probably a case of using the expose-loader |
I haven't been able to test it but, i believe this is how you would do this:
|
This adds a new option (--debug) to build/build.py which allows building for debugging. This will expose all internal members on the global |shaka| object and will not rename anything. This allows apps to import the single compiled file but still perform debugging. This also changes the file naming a little. Before, we would create a |.debug.js| and |.debug.map| file when we compiled. However this was not a debug file, it just linked to the source map. Now it will always generate the source map and attach it to the compiled file. If compiling with --debug it will add |.debug| to the file name. This should also help with importing the debug library in ES6. Issue #466 Change-Id: Ic51abbdb04763e8a3687c5d59a23d721436e1c7b
Now you can pass We will also be adding the debug version of the compiled library to future versions on npm. So you can include |
@mseeley does this work for you? Can I close this? |
Hi @TheModMaker. It sounds like it could; thanks a lot for the ping. :) Please feel free to close this. I'll open an issue with updated context if we have trouble. Thanks! |
Getting started with Shaka is easy. Install
shaka-player
through npm and step through the basic usage documentation and quickly we're playing a video. This is good thanks.Our application is build on ES6 modules using WebPack and Babel. Including shaka-player into our player is as simple as:
import shaka from 'shaka-player';
Going from this to a uncompiled version is unclear. The good velocity from setup and getting started hit a wall.
In order to run in uncompiled mode we have to checkout the repo, build deps, then include these files in an HTML document. What's implied is the HTML document is in the root of the
shaka-player
repo. This is fine when you're debugging isolated test cases. This is nearly impossible to use when debugging integration issues with application logic.Integrating an uncompiled Shaka Player into an application is unclear. The
script
element recommendation won't work, dep paths are inaccessible. Importing the three files also doesn't work; they collaborate using global variables and don't understand exports. So, theimport
approach above doesn't work as:It was a long shot anyway. I didn't expect the multiple import approach to work, but, hey, grasping for uncompiled straws.
Will you please consider making it easier to debug integration issues? As a developer, quickly swapping a CDNJS link from the compiled to concatenated but not mangled build would be effortless. Same is true to use a
import shaka from 'shaka-player/debug'
.I'm unsure if "compiled" means concatenated and minified in the Closure Compiler world. If not, please do consider making debugging flexible while avoiding requiring users build their own players from source.
Thanks for reading!
The text was updated successfully, but these errors were encountered: