WilliamVenner / grafana-timepicker-buttons

📊 Datasource-configured buttons panel plugin which set the time range of your Grafana dashboard
https://grafana.com/grafana/plugins/williamvenner-timepickerbuttons-panel
Apache License 2.0
47 stars 11 forks source link

Compilation failed - unexpected token: keyword "const" #3

Closed bergercookie closed 4 years ago

bergercookie commented 4 years ago

I'm getting the following error while trying to compile the master branch:

berger on nikos-desktop in ~/src/timepicker-buttons on  master is 📦 v1.0.0 via ⬢ v12.11.0 took 8s

✦ at [23:24:58] ➜ yarn build
yarn run v1.19.1
$ node --max-old-space-size=8192 ./node_modules/.bin/webpack --config webpack.config.prod.js
clean-webpack-plugin: /home/berger/src/timepicker-buttons2/dist has been removed.
Hash: b74a2e2513922ffd20b2
Version: webpack 4.43.0
Time: 6926ms
Built at: 06/12/2020 23:25:06
 2 assets
Entrypoint module = module.js module.js.map
 [48] external "lodash" 42 bytes {0} [built]
 [99] ./module.ts 4.53 KiB {0} [built]
[100] external "app/plugins/sdk" 42 bytes {0} [built]
[106] util (ignored) 15 bytes {0} [built]
[108] util (ignored) 15 bytes {0} [built]
[140] ./css/timepicker-btns.css 545 bytes {0} [built]
[142] ../node_modules/css-loader/dist/cjs.js??ref--5-1!./css/timepicker-btns.css 741 bytes {0} [built]
    + 137 hidden modules
ERROR in module.js from UglifyJs
Unexpected token: keyword «const» [../node_modules/apache-arrow/type.js:19,0][module.js:110,0]
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I did a bit of googling and this must be due to UglifyJS not supporting ES6. I've tried replacing it with terser-webpack in my fork but that doesn't seem to work and the timepicker widget isn't even visible in the grafana dashboard.

Notice that I don't really know my way around JS or webpack so my workaround may as well be completely wrong.

Any pointers?

P.S. Thanks for this great project! :)

WilliamVenner commented 4 years ago

Thanks so much, fixed in https://github.com/WilliamVenner/grafana-timepicker-buttons/commit/e3c1178f7b0bab8eab86745d6e8be4836ad117da