Use babel in the build process.
MODIFY
package-lock.json
package-lock.json
"babel-template": "6.26.0"
}
},
+ "babel-loader": {
+ "version": "7.1.5",
+ "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-7.1.5.tgz",
+ "integrity": "sha512-iCHfbieL5d1LfOQeeVJEUyD9rTwBcP/fcEbRCfempxTDuqrKpu0AZjLAQHEQa3Yqyj9ORKe2iHfoj4rHLf7xpw==",
+ "dev": true,
+ "requires": {
+ "find-cache-dir": "1.0.0",
+ "loader-utils": "1.1.0",
+ "mkdirp": "0.5.1"
+ }
+ },
"babel-messages": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
"babel-types": "6.26.0"
}
},
+ "babel-preset-env": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz",
+ "integrity": "sha512-9OR2afuKDneX2/q2EurSftUYM0xGu4O2D9adAhVfADDhrYDaxXV0rBbevVYoY9n6nyX1PmQW/0jtpJvUNr9CHg==",
+ "dev": true,
+ "requires": {
+ "babel-plugin-check-es2015-constants": "6.22.0",
+ "babel-plugin-syntax-trailing-function-commas": "6.22.0",
+ "babel-plugin-transform-async-to-generator": "6.24.1",
+ "babel-plugin-transform-es2015-arrow-functions": "6.22.0",
+ "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0",
+ "babel-plugin-transform-es2015-block-scoping": "6.26.0",
+ "babel-plugin-transform-es2015-classes": "6.24.1",
+ "babel-plugin-transform-es2015-computed-properties": "6.24.1",
+ "babel-plugin-transform-es2015-destructuring": "6.23.0",
+ "babel-plugin-transform-es2015-duplicate-keys": "6.24.1",
+ "babel-plugin-transform-es2015-for-of": "6.23.0",
+ "babel-plugin-transform-es2015-function-name": "6.24.1",
+ "babel-plugin-transform-es2015-literals": "6.22.0",
+ "babel-plugin-transform-es2015-modules-amd": "6.24.1",
+ "babel-plugin-transform-es2015-modules-commonjs": "6.26.2",
+ "babel-plugin-transform-es2015-modules-systemjs": "6.24.1",
+ "babel-plugin-transform-es2015-modules-umd": "6.24.1",
+ "babel-plugin-transform-es2015-object-super": "6.24.1",
+ "babel-plugin-transform-es2015-parameters": "6.24.1",
+ "babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
+ "babel-plugin-transform-es2015-spread": "6.22.0",
+ "babel-plugin-transform-es2015-sticky-regex": "6.24.1",
+ "babel-plugin-transform-es2015-template-literals": "6.22.0",
+ "babel-plugin-transform-es2015-typeof-symbol": "6.23.0",
+ "babel-plugin-transform-es2015-unicode-regex": "6.24.1",
+ "babel-plugin-transform-exponentiation-operator": "6.24.1",
+ "babel-plugin-transform-regenerator": "6.26.0",
+ "browserslist": "3.2.8",
+ "invariant": "2.2.4",
+ "semver": "5.5.0"
+ },
+ "dependencies": {
+ "browserslist": {
+ "version": "3.2.8",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz",
+ "integrity": "sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==",
+ "dev": true,
+ "requires": {
+ "caniuse-lite": "1.0.30000874",
+ "electron-to-chromium": "1.3.52"
+ }
+ }
+ }
+ },
"babel-preset-es2015": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz",
"integrity": "sha1-P25Ttj03N2i/meiWEz1m74nEmZk=",
"dev": true
},
+ "caniuse-lite": {
+ "version": "1.0.30000874",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000874.tgz",
+ "integrity": "sha512-29nr1EPiHwrJTAHHsEmTt2h+55L8j2GNFdAcYPlRy2NX6iFz7ZZiepVI7kP/QqlnHLq3KvfWpbmGa0d063U09w==",
+ "dev": true
+ },
"canvas-prebuilt": {
"version": "1.6.5-prerelease.1",
"resolved": "https://registry.npmjs.org/canvas-prebuilt/-/canvas-prebuilt-1.6.5-prerelease.1.tgz",

MODIFY
package.json
package.json
"hammerjs": "^2.0.8"
},
"devDependencies": {
+ "babel-core": "^6.26.3",
+ "babel-loader": "^7.1.5",
+ "babel-preset-env": "^1.7.0",
"body-parser": "^1.15.0",
"bootstrap": "^3.3.6",
"bootswatch": "^3.3.6",

MODIFY
webpack.base.config.js
webpack.base.config.js
@@ -75,6 +75,28 @@ module.exports = {
*/
module: {
rules: [{
+ test: /\.js$/,
+ include: [
+ path.resolve(__dirname, 'src'),
+ path.resolve(__dirname, 'tests'),
+ path.resolve(__dirname, 'examples'),
+ path.resolve(__dirname, 'tutorials')
+ ],
+ use: [{
+ loader: 'babel-loader',
+ options: {
+ presets: [[
+ 'env', {
+ targets: {
+ node: true,
+ browsers: ['defaults'],
+ uglify: true
+ }
+ }
+ ]]
+ }
+ }]
+ }, {
test: /\.styl$/,
use: [
'style-loader',

Use babel in the build process.