-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Webpack toolchain #2
Conversation
Thanks for PR. I am investigating proposed ability to integrate Webpack as main or additional toolchain across all the projects. Can you advise how to use generated by Webpack P2pMediaLoaderCore.umd.js in a browser? |
a UMD (see You can also use the Anyway it is very easy to produce several types of builds at once, or depending on the environment (prod/debug). I would also recommend that you use global exports as little as possible and build everything "in-tree" to one bundle, once the final demo application is built. Another possibility with Webpack is to always import dependencies even if they might be available in the global scope, and then configure them as "externals". That way your code is formaly requiring all dependencies it uses, and you can decide wether this will be resolved at build or at runtime (from the environment somehow as global or var import). See https://webpack.js.org/configuration/externals/ |
@mrlika This isn't too important, but working with webpack eases a lot the development process i think. There are other proposals concerning the P2P technology and the player integration, testing and scaling that I would like to make! ;) |
Yes. I was expecting it to behave this way when I loaded it using a <script> tag. It uses window object as root but factory() returns undefined: root["P2pMediaLoaderCore"] = factory(); |
I see. There might some details about how you did your public API that we have to look into to get this right. But I am confident that whatever you want to do is included in webpack. But moreover I believe it is more scaleable. For example you could have one webpack config for the core, and the different player integrations, and the demo, building all various assets/bundles in parallel, but serving them from one local dev host. Or building integration tests for all that etc ... You can centralize your build config and then choose what to do depending on your environment. In fact as your architecture tends to be something that will have like "plugins" for each player/streaming engine, you will probably want to go with a build system that is more extendable :) |
@mrlika Just wondering, in fact I'm not sure I understood what the What I actually do is, I try to build an own "plugin" for a player here, and in the same strike I also try to build an integrated toolchain for the project here. As I get this to work, I'll update the PR here with my proposal. Currently not everything might work as I haven't validated it with the end-to-end build, but I am on it at the moment. My aim is that one can build the demo, plugins and the core in one dev-server process. |
@mrlika Understood the issue you re seeing, and that |
The problem was "too much config" :) This works now so far in terms of exporting things. |
My apologies for the slow reply; had no time to review the PR because of vacation. Using you PR as a base I managed to configure cross-project incremental build via webpack. Also configured exposing module into window.p2pml object for webpack bundles in the same way as it is now done with browserify that makes both builds compatible. I am still testing and finalizing the changes. And in case of no issues will include webpack toolchain into the projects. |
Done. Now webpack incremental build is supported. |
Maybe we should consider replacing the existing toolchain with webpack completely?