Help creating the global umd files for people that want to use script tags and use everything...
Needs to output:
We don't want
webpack:// urls in the source maps file. source map paths must be relative to the bundle like ../src/*.rxjs in global scope (This seems to be the default with webpack :man_shrugging: )build:umd. It should work there.package/src and build from that, since that directory needs to be there anyhow.npm run build. We don't want to change anything else about the build script, it's building everything else (seemingly) just fine. package/. Everything that's being put there in the build process needs to be there.package/bundlesExperimental branch can be found at: https://github.com/reactivex/rxjs/tree/experimental
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
rxjsin 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!
Most helpful comment
I'll help :)