Skip to content

Commit

Permalink
Add ECMAScript 2015 compilation support
Browse files Browse the repository at this point in the history
  • Loading branch information
thefaiz committed Oct 9, 2017
1 parent f12c683 commit da3f28d
Show file tree
Hide file tree
Showing 6 changed files with 700 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["env"]
}
15 changes: 13 additions & 2 deletions dist/js/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,20 @@
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
/***/ (function(module, exports, __webpack_require__) {

console.log('Hello, world!');
"use strict";


function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Example = function Example() {
_classCallCheck(this, Example);

console.log('Example class instantiated.');
};

new Example();

/***/ })
/******/ ]);
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"license": "MIT",
"dependencies": {
"webpack": "^3.6.0"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0"
}
}
8 changes: 7 additions & 1 deletion src/js/main.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
console.log('Hello, world!');
class Example {
constructor() {
console.log('Example class instantiated.')
}
}

(new Example);
11 changes: 11 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,16 @@ module.exports = {
output: {
path: __dirname + '/dist/js',
filename: 'bundle.js'
},

module: {
loaders:
[
{
test: /\.js$/,
exclude: /node_modules/,
loaders: 'babel-loader'
}
]
}
};
Loading

0 comments on commit da3f28d

Please sign in to comment.