File tree Expand file tree Collapse file tree 1 file changed +28
-11
lines changed
Expand file tree Collapse file tree 1 file changed +28
-11
lines changed Original file line number Diff line number Diff line change 1- Babel (6to5) Plugin
1+ Babel Plugin
22===
33
44A [ Babel] ( https://babeljs.io/ ) loader plugin for [ RequireJS] ( http://requirejs.org ) .
55
66Installation
77---
88
9- ```
10- $ npm install -g bower
11- $ bower install https://github.com/hipertracker/requirejs-babel
9+ ``` bash
10+ npm install hipertracker/requirejs-babel
1211```
1312
1413Usage
1514---
1615
17- Add the paths to configuration:
16+ Add the paths and shim to configuration:
1817
1918``` javascript
20- paths: {
21- es6: ' ...path_to_bower/requirejs-babel/es6' ,
22- babel: ' ...path_to_bower/requirejs-babel/babel.min'
23- }
19+ paths: {
20+ babel: ' vendor/requirejs-babel/babel' ,
21+ babel_polyfill: ' vendor/requirejs-babel/polyfill.min' ,
22+ es6: ' vendor/requirejs-babel/es6'
23+ },
24+ shim: {
25+ babel: {
26+ deps: [' babel_polyfill' ]
27+ }
2428` ` `
2529
26- Reference files via the es6! plugin name:
30+ Reference files via the ` es6! ` plugin name:
31+
32+ new ES6 syntax (better)
2733` ` ` javascript
28- define ([' es6!your-es6-module' ], function (module ) {
34+ import MyEs6Module from ' es6!./my-es6-module'
35+ ` ` `
36+ or plain old AMD syntax:
37+
38+ ` ` ` javascript
39+ define ([' es6!./my-es6-module' ], function (MyEs6Module ) {
2940 // ...
3041 });
3142` ` `
43+
44+ ` ` ` html
45+ ... .
46+ < script src= " ./requirejs-config.js" >< / script>
47+ < script src= " ./vendor/requirejs/require.js" data- main= " es6!./src/main" >< / script>
48+ ` ` `
You can’t perform that action at this time.
0 commit comments