Giter Club home page Giter Club logo

babel-config's Introduction

@videojs/babel-config

Build Status Greenkeeper badge Slack Status

Currently babel configs are the same for most plugins, and most of them are built using this babel config via babel. We have some libraries though that are should not be built using rollup for nodejs consumption, that are currently doing so. So this config while still consumed by videojs-generate-rollup-config can also be used standalone with babel-cli.

Lead Maintainer: Brandon Casey @brandonocasey

Maintenance Status: Stable

Table of Contents

Installation

$ npm install --save-dev @babel/cli @videojs/babel-config

Usage

  1. In your rollup config add a line to delete module builds:
if (config.builds.module) {
  delete config.builds.module;
}
  1. Add a npm scripts for cjs/es dists to your package.json:
{
  "build:cjs": "babel-config-cjs -d ./cjs ./src",
  "build:es": "babel-config-es -d ./es ./src",
  "watch:cjs": "npm run build:cjs -- -w",
  "watch:es": "npm run build:es -- -w"
}
  1. verify that main in package.json is set to the cjs dist. Something like cjs/index.js
  2. verify that module in package.json is set to the es dist. Something like es/index.js
  3. verify that browser in package.json is set to the browser dist. Something like dist/project-name.js
  4. Make sure that es/ and cjs/ are in files in package.json
  5. Add /es and /cjs to .gitignore.
  6. Add ./es and ./cjs to the npm script for clean after mkdir -p and rm -rf.
shx rm -rf ./dist ./test/dist ./cjs ./es && shx mkdir -p ./dist ./test/dist ./cjs ./es
``


## Important things
* When running through `babel-config-cjs`, `babel-config-es`, or `babel-config-run` if the `TEST_BUNDLE_ONLY` environment variable is set **nothing** will run! This is to maintain parity with [`videojs-generate-rollup-config`](https://github.com/videojs/videojs-generate-rollup-config).
* The `babel-config-cjs` binary runs babel cli with `--verbose` and `--config-file` set to the cjs config exported here.
* The `babel-config-es` binary runs babel cli with `--verbose` and `--config-file` set to the es config exported here.
* The `babel-config-run` binary runs babel cli with `--verbose` but no config file.

## Changing configuration
1. require the configuration you want to use `const config = require('@videojs/babel-config/cjs.js');`
2. Make changes to it and export: `module.export = config`.
3. Change the build scripts to  `babel-config-run --config-file <new-config> ...`

babel-config's People

Contributors

brandonocasey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.