Add babel-plugin-unpkg-rewrite package

This commit is contained in:
MICHAEL JACKSON
2017-11-25 14:02:35 -08:00
parent 72446cff9b
commit 552a3ff5c0
5 changed files with 1429 additions and 0 deletions

View File

@ -0,0 +1,38 @@
A [Babel](http://babeljs.io/) plugin that rewrites bare ES module specifiers as
[unpkg](https://unpkg.com) URLs.
## input
```jsx
import React from "react"
import router from "@angular/router"
import map from "lodash.map"
import fs from "pn/fs"
import cupcakes from "./cupcakes"
import shoelaces from "/shoelaces"
import something from "//something.com/whatevs"
import something from "http://something.com/whatevs"
let ReactDOM = require("react-dom")
export React from "react"
export { Component } from "react"
export * from "react"
export var message = "hello"
```
## output
```jsx
import React from "https://unpkg.com/react@15.6.1?module"
import router from "https://unpkg.com/@angular/router@4.3.5?module"
import map from "https://unpkg.com/lodash.map@4.6.0?module"
import fs from "https://unpkg.com/pn@1.0.0/fs?module"
import cupcakes from "./cupcakes?module"
import shoelaces from "/shoelaces?module"
import something from "//something.com/whatevs"
import something from "http://something.com/whatevs"
let ReactDOM = require("react-dom")
export React from "https://unpkg.com/react@15.6.1?module"
export { Component } from "https://unpkg.com/react@15.6.1?module"
export * from "https://unpkg.com/react@15.6.1?module"
export var message = "hello"
```