Skip to content

Commit 3602f11

Browse files
author
Andrew Schmadel
committed
use preset-env instead of preset-es2015
1 parent 33979d7 commit 3602f11

File tree

8 files changed

+591
-497
lines changed

8 files changed

+591
-497
lines changed

.babelrc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
{
2-
"presets": ["es2015"]
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"targets": {
7+
"browsers": ["last 2 versions"]
8+
}
9+
}
10+
]
11+
]
312
}

docs/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ <h3>Warnings</h3>
8787
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.17.0/codemirror.js"></script>
8888
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.17.0/mode/javascript/javascript.js"></script>
8989

90-
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.10.3/babel.js"></script>
90+
<script src='https://unpkg.com/babel-standalone@6/babel.js' defer></script>
91+
<script src='https://unpkg.com/babel-polyfill@6/dist/polyfill.min.js' defer></script>
92+
<script src='https://unpkg.com/[email protected]/babel-preset-env.js' defer></script>
9193
<script src="repl-browser.js"></script>
9294

9395
<script>
@@ -105,7 +107,7 @@ <h3>Warnings</h3>
105107
continueComments: "Enter",
106108
readOnly: true
107109
};
108-
110+
109111
var input = CodeMirror(document.getElementById('input'), inputOpts);
110112
var output = CodeMirror(document.getElementById('output'), outputOpts);
111113

@@ -141,4 +143,4 @@ <h3>Warnings</h3>
141143
document.getElementById('es5').onchange = function(){ change(input) }
142144
</script>
143145
</body>
144-
</html>
146+
</html>

docs/repl-browser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,16 @@ module.exports = function () {
157157

158158
// super-simple in-browser REPL for testing this thing
159159
// to build:
160-
//
160+
//
161161
// npm install -g browserify
162162
// browserify repl.js -o repl-browser.js
163163

164164
var plugin = require('../babel-ng-annotate');
165165

166166
window.transform = function (code, es2015) {
167+
167168
return Babel.transform(code, {
168-
presets: es2015 ? ['es2015'] : [],
169+
presets: es2015 ? [window.babelPresetEnv.default] : [],
169170
plugins: [plugin]
170171
});
171172
};

docs/repl.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
// super-simple in-browser REPL for testing this thing
22
// to build:
3-
//
3+
//
44
// npm install -g browserify
55
// browserify repl.js -o repl-browser.js
66

77
var plugin = require('../babel-ng-annotate');
88

99
window.transform = function(code, es2015){
10+
1011
return Babel.transform(code, {
11-
presets: es2015 ? ['es2015'] : [],
12+
presets: es2015 ? [window.babelPresetEnv.default] : [],
1213
plugins: [plugin]
1314
});
14-
}
15+
}

0 commit comments

Comments
 (0)