Hygiene: enable Babel transpilation

Enable the Babel transpiler so that ES6 template literals,
destructuring, and arrow functions can be used in production.
"last n versions" syntax was not used so that builds are more
reproducible.

Bug: T165036
Change-Id: I553b6d14cc368c7b4366f68d13038c3d505f5429
This commit is contained in:
Stephen Niedzielski 2018-03-12 10:28:23 -05:00
parent d35286a064
commit e5df865d51
5 changed files with 56 additions and 0 deletions

23
.babelrc Normal file
View file

@ -0,0 +1,23 @@
{
"presets": [
[
"env",
{
// Do not transform modules to CommonJS.
"modules": false,
// See modern tier: https://www.mediawiki.org/wiki/Compatibility#Browser_support_matrix
"targets": {
// https://en.wikipedia.org/wiki/Google_Chrome_version_history
"chrome": "64",
"ie": "11",
// https://en.wikipedia.org/wiki/Firefox_version_history
"firefox": "58",
"safari": "5.1",
"opera": "15",
"ios": "6.1",
"android": "4.1"
}
}
]
]
}

24
package-lock.json generated
View file

@ -546,6 +546,30 @@
"babel-template": "6.26.0"
}
},
"babel-loader": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-7.1.4.tgz",
"integrity": "sha512-/hbyEvPzBJuGpk9o80R0ZyTej6heEOr59GoEUtn8qFKbnx4cJm9FWES6J/iv644sYgrtVw9JJQkjaLW/bqb5gw==",
"dev": true,
"requires": {
"find-cache-dir": "1.0.0",
"loader-utils": "1.1.0",
"mkdirp": "0.5.1"
},
"dependencies": {
"loader-utils": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz",
"integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=",
"dev": true,
"requires": {
"big.js": "3.2.0",
"emojis-list": "2.1.0",
"json5": "0.5.1"
}
}
}
},
"babel-messages": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",

View file

@ -13,6 +13,7 @@
"precommit": "npm run test:dev && npm run build && git add resources/dist && bundlesize"
},
"devDependencies": {
"babel-loader": "7.1.4",
"babel-preset-env": "^1.6.0",
"babel-register": "^6.24.1",
"bundlesize": "0.15.3",

Binary file not shown.

View file

@ -48,6 +48,14 @@ conf = {
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: { cacheDirectory: true }
}
},
{
test: /\.svg$/,
loader: 'svg-inline-loader',