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

Created on 8 Nov 2018  ·  5Comments  ·  Source: ReactiveX/rxjs

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 :man_shrugging: )

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

Help Wanted

Most helpful comment

I'll help :)

All 5 comments

I'll help :)

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.

@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 👍

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

No worries @rich-harris is the best man for the job!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peterbakonyi05 picture peterbakonyi05  ·  4Comments

giovannicandido picture giovannicandido  ·  4Comments

LittleFox94 picture LittleFox94  ·  3Comments

benlesh picture benlesh  ·  3Comments

marcusradell picture marcusradell  ·  4Comments