Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS tooling: upgrade to babel 7 #13873

Merged
merged 4 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": { "browsers": "last 3 versions" },
"useBuiltIns": "entry"
}
]
]
}
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"url": "http://github.com/grafana/grafana.git"
},
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.1.0",
"@types/d3": "^4.10.1",
"@types/enzyme": "^3.1.13",
"@types/jest": "^23.3.2",
Expand All @@ -21,10 +27,10 @@
"angular-mocks": "1.6.6",
"autoprefixer": "^6.4.0",
"axios": "^0.17.1",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-es2015": "^6.24.1",
"babel-core": "^7.0.0-bridge",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"babel-plugin-angularjs-annotate": "^0.9.0",
"clean-webpack-plugin": "^0.1.19",
"css-loader": "^0.28.7",
"enzyme": "^3.6.0",
Expand Down Expand Up @@ -127,13 +133,12 @@
},
"license": "Apache-2.0",
"dependencies": {
"@babel/polyfill": "^7.0.0",
"angular": "1.6.6",
"angular-bindonce": "0.3.1",
"angular-native-dragdrop": "1.2.2",
"angular-route": "1.6.6",
"angular-sanitize": "1.6.6",
"babel-jest": "^23.6.0",
"babel-polyfill": "^6.26.0",
"baron": "^3.0.3",
"brace": "^0.10.0",
"classnames": "^2.2.5",
Expand Down
2 changes: 1 addition & 1 deletion public/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'babel-polyfill';
import '@babel/polyfill';
import 'file-saver';
import 'lodash';
import 'jquery';
Expand Down
2 changes: 1 addition & 1 deletion public/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// context.keys().forEach(context);
// module.exports = context;

import 'babel-polyfill';
import '@babel/polyfill';
import 'jquery';
import angular from 'angular';
import 'angular-mocks';
Expand Down
26 changes: 16 additions & 10 deletions scripts/webpack/webpack.hot.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,31 @@ module.exports = merge(common, {
module: {
rules: [
{
test: /\.tsx?$/,
test: /\.(j|t)sx?$/,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davkal what's the reasoning behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted the config to be the same as in react-hot-reloader README in case I overlooked something. jsx? won't be included in this PR. Thanks for highlighting it out though.

exclude: /node_modules/,
use: [{
loader: 'babel-loader',
options: {
cacheDirectory: true,
babelrc: false,
plugins: [
'syntax-dynamic-import',
["@babel/plugin-proposal-class-properties", { loose: true }],
'angularjs-annotate',
'syntax-dynamic-import', // needed for `() => import()` in routes.ts
'react-hot-loader/babel'
]
],
presets: [
[
'@babel/preset-env',
{
targets: { browsers: 'last 3 versions' },
useBuiltIns: 'entry'
}
],
'@babel/preset-typescript',
'@babel/preset-react'
],
}
},
{
loader: 'ts-loader',
options: {
transpileOnly: true,
experimentalWatchApi: true
},
}],
},
{
Expand Down