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
Conversation
if dashboard is null there is could be that somehow pre assign bindings is not enabled . https://github.com/grafana/grafana/blob/master/public/app/app.ts#L70 not sure why hot reload should cause issues with this binding flag |
The bundle implications are negligible: Before:
After:
|
scripts/webpack/webpack.hot.js
Outdated
@@ -47,25 +47,31 @@ module.exports = merge(common, { | |||
module: { | |||
rules: [ | |||
{ | |||
test: /\.tsx?$/, | |||
test: /\.(j|t)sx?$/, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
This was tricky. Somehow babel is doing stuff that is not compatible or the same as typescript output. Babel is setting class properties to undefined. which breaks angularjs bindings that pre assigns properties before calling constructor. Possibly related issues Not sure how to fix this. Tried some suggestions in those issues without success. |
properties to void 0. This breaks angularjs preAssignBinding which applies bindings to this before constructor is called. Fixed by using fork of babel plugin. babel/babel#8417
Pushed a fix using fork of the problematic babel plugin, Also investigated the why the type warnings show up (Bug in webpack where there currently is no workaround other than filtering them out), they are filtered out in normal webpack watch mode using stats warningFilter, but this seems to be ignored by webpack dev server: |
LGTM now. |
useBuiltIns
to govern what is included from babel polyfillSeems to work ok for
yarn build
andyarn dev
. But withyarn start
I get errors when accessing a dashboard:TypeError: Cannot read property 'meta' of undefined
which seems to come fromdashnav.ts
:Somehow the instantiation is not working (
dashboard
is missing, which is supplied via an angular directive).