Skip to content

Commit

Permalink
Use buble and polyfills to support ES5 in bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbtucker committed Aug 18, 2018
1 parent 3b44f2e commit e16abb4
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
6 changes: 6 additions & 0 deletions build/es5.js
@@ -0,0 +1,6 @@
require('core-js/fn/string/code-point-at')
require('core-js/fn/string/from-code-point')

const JSON5 = require('../lib')

module.exports = JSON5
51 changes: 50 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -50,6 +50,7 @@
"minimist": "^1.2.0"
},
"devDependencies": {
"core-js": "^2.5.7",
"eslint": "^5.3.0",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.14.0",
Expand All @@ -58,6 +59,7 @@
"eslint-plugin-standard": "^3.1.0",
"regenerate": "^1.4.0",
"rollup": "^0.64.1",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-commonjs": "^9.1.5",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-terser": "^1.0.1",
Expand Down
7 changes: 5 additions & 2 deletions rollup.config.js
@@ -1,12 +1,13 @@
const resolve = require('rollup-plugin-node-resolve')
const commonjs = require('rollup-plugin-commonjs')
const buble = require('rollup-plugin-buble')
const terser = require('rollup-plugin-terser').terser
const pkg = require('./package.json')

module.exports = [
// Non-minified
{
input: 'lib/index.js',
input: 'build/es5.js',
output: {
file: pkg.browser,
format: 'umd',
Expand All @@ -15,11 +16,12 @@ module.exports = [
plugins: [
resolve(),
commonjs(),
buble({transforms: {dangerousForOf: true}}),
],
},
// Minified
{
input: 'lib/index.js',
input: 'build/es5.js',
output: {
file: pkg.browser.replace(/\.js$/, '.min.js'),
format: 'umd',
Expand All @@ -28,6 +30,7 @@ module.exports = [
plugins: [
resolve(),
commonjs(),
buble({transforms: {dangerousForOf: true}}),
terser(),
],
},
Expand Down

0 comments on commit e16abb4

Please sign in to comment.