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

Improve Code Packaging an Delivery #20

Closed
12 tasks
pahund opened this issue Jan 6, 2020 · 2 comments
Closed
12 tasks

Improve Code Packaging an Delivery #20

pahund opened this issue Jan 6, 2020 · 2 comments
Milestone

Comments

@pahund
Copy link

pahund commented Jan 6, 2020

Currently (version 2.x.x), there are two ways to include React Prebid in a project:

  • Using index-esnext.js – this is the untranspiled code using ES modules, needs to be run through Babel before it can be used
  • Using index.js – this is the transpiled version that can be used directly in the browser

The problem with this approach: It is hard to debug the minified code (see issue #18). To solve this, we should provide the transpiled and unminified code per default. Users who want to use react-prebid through a CDN should be able to download the transpiled and minified bundle from UNPKG.

Requirements

  • All JavaScript bundles that are intended to be imported by client applications are be placed in a dist folder, which is not under source control and created on the fly by the webpack build
  • The webpack build creates the following files in the dist folder:
    • index.js – transpiled, unminified Common JS bundle, to be imported with a require statement
    • index.js.map – source map for index.js
    • react-prebid.esm.js – untranspiled, unminified source code, bundled into one file, to be imported as ES module with an import statement
    • react-prebid.esm.js.map – source map for react-prebid.esm.js
    • react-prebid.umd.js – transpiled, unminified UMD bundle, to be incuded in web pages through a script tag, loaded from a CDN
    • react-prebid.umd.js.map – source map for react-prebid.umd
    • react-prebid.umd.min.js – transpiled, minified UMD bundle, to be incuded in web pages through a script tag, loaded from a CDN
    • react-prebid.umd.min.js.map – source map for react-prebid.min.umd
  • The package.json file points to the various bundles:
    • "main": "dist/index.js"
    • "module": "dist/react-prebid.esm.js"
    • "unpkg": "dist/redux-toolkit.umd.min.js"
  • The documentation explains how to import React Prebid
    • as Common JS module
    • as an ES module
    • as a UMD bundle through the UNPKG CDN
  • Description of release 3.0.0 on the releases page includes a migration guide from 2.x.x
@pahund pahund added this to the 3.0.0 milestone Jan 6, 2020
@pahund pahund mentioned this issue Jan 6, 2020
@mattcolman
Copy link
Contributor

LGTM!

@pahund
Copy link
Author

pahund commented Jan 6, 2020

Do you want to take care of this?

pahund pushed a commit that referenced this issue Jan 8, 2020
Change-Id: Iac624b8f8b024b54af4424e077ca8f7951eea640
@pahund pahund closed this as completed Jan 9, 2020
pahund pushed a commit that referenced this issue Jan 16, 2020
Change-Id: Iac624b8f8b024b54af4424e077ca8f7951eea640
pahund pushed a commit that referenced this issue Jul 3, 2020
Change-Id: Iac624b8f8b024b54af4424e077ca8f7951eea640
pahund pushed a commit that referenced this issue Jul 3, 2020
* updated nvm config to use current LTS version 12
* Issue #20 - fine tuned webpack build for unpkg CDN distribution
* MOVE-12525: changed babel config to fix error with common JS lib
* MOVE-12525: fixed babel config
* changed name of npm package to react-advertising
* Updated all npm package dependencies
* Reformatted JS code with latest Prettier settings
* Removed Wallaby config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants