Skip to content
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

HELP WANTED: Need UMD global builds for RxJS 7 (experimental branch) #4324

Closed
benlesh opened this issue Nov 8, 2018 · 5 comments
Closed
Labels
help wanted Issues we wouldn't mind assistance with.

Comments

@benlesh
Copy link
Member

benlesh commented Nov 8, 2018

WANTED

Help creating the global umd files for people that want to use script tags and use everything...

Needs to output:

  • package/bundles/rxjs.umd.js
  • package/bundles/rxjs.umd.js.map
  • package/bundles/rxjs.umd.min.js
  • package/bundles/rxjs.umd.min.js.map

We don't want

  • Weird webpack:// urls in the source maps file. source map paths must be relative to the bundle like ../src/*.
  • Minified versions that don't actually set rxjs in global scope (This seems to be the default with webpack 🤷‍♂️ )

NOTES

  • There's already an npm script called build:umd. It should work there.
  • The general idea of what exists is to copy sources to package/src and build from that, since that directory needs to be there anyhow.
  • Needs to work as part of npm run build. We don't want to change anything else about the build script, it's building everything else (seemingly) just fine.
  • Can't additionally alter the structure of package/. Everything that's being put there in the build process needs to be there.
  • Just needs to put bundles and their sourcemaps under package/bundles
  • We don't want or need a whole bunch of new npm scripts
  • Needs to work on Windows.

Experimental branch can be found at: https://github.com/reactivex/rxjs/tree/experimental

@benlesh benlesh added the help wanted Issues we wouldn't mind assistance with. label Nov 8, 2018
@benlesh benlesh changed the title Need UMD global builds for RxJS 7 (experimental branch) HELP WANTED: Need UMD global builds for RxJS 7 (experimental branch) Nov 8, 2018
@wardpeet
Copy link

wardpeet commented Nov 8, 2018

I'll help :)

@sokra
Copy link

sokra commented Nov 8, 2018

While rollup is probably the better choice here are the options you want to look into for webpack:

  • Weird webpack:// urls in the source maps file. source map paths must be relative to the bundle like ../src/*.

output.devtoolModuleFilenameTemplate with [resource-path] or a custom function

You can set context for the "relative to" stuff

  • Minified versions that don't actually set rxjs in global scope (This seems to be the default with webpack 🤷‍♂️ )

output.libraryTarget: "umd"


IMPORTANT NOTE: When bundling you will loose the benefit of "sideEffects": false in your package.json. This allows the bundler to skip whole modules, which no longer works with a single bundle. So it doesn't make sense to offer a bundled version for bundlers. Best provide EcmaScript modules split into multiple files, a index.js reexporting (export { ... } from "...") other modules and a package.json with "sideEffects": false and a "module" field pointing to these modules.

@wardpeet
Copy link

wardpeet commented Nov 8, 2018

@sokra

IMPORTANT NOTE: When bundling you will loose the benefit of "sideEffects": false in your package.json. This allows the bundler to skip whole modules, which no longer works with a single bundle. So it doesn't make sense to offer a bundled version for bundlers. Best provide EcmaScript modules split into multiple files, a index.js reexporting (export { ... } from "...") other modules and a package.json with "sideEffects": false and a "module" field pointing to these modules.

if we export a module & main entry in package.json webpack will still use the sideEffects for the module entry right?

I was thinking of going for rollup to 👍

@benlesh
Copy link
Member Author

benlesh commented Nov 8, 2018

Sorry @wardpeet, it looks like @Rich-Harris beat you to the punch. I greatly appreciate your thought and efforts, though!

@wardpeet
Copy link

wardpeet commented Nov 8, 2018

No worries @Rich-Harris is the best man for the job!

@benlesh benlesh closed this as completed Jan 9, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Issues we wouldn't mind assistance with.
Projects
None yet
Development

No branches or pull requests

3 participants