janniks / vue-notion

A fast Vue renderer for Notion pages
https://vue-notion.now.sh
Other
883 stars 63 forks source link

nullish coalescing operator compatibility #30

Closed silverling closed 3 years ago

silverling commented 3 years ago

Hey, thank you for what you have done in this project. Here I'd like to use this module in my gridsome project, which is based on Vue. When I installed this module and followed the tutorial from README.md, I got the following error.

 ERROR  Failed to compile with 1 errors                                                                                            9:06:53 PM

 error  in ./node_modules/vue-notion/dist/esm.js

Module parse failed: Unexpected token (136:128)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     return {
|       block_aspect_ratio: (_this$format = this.format) === null || _this$format === void 0 ? void 0 : _this$format.block_aspect_ratio,
>       block_height: ((_this$format2 = this.format) === null || _this$format2 === void 0 ? void 0 : _this$format2.block_height) ?? 1,
|       block_width: ((_this$format3 = this.format) === null || _this$format3 === void 0 ? void 0 : _this$format3.block_width) ?? 1,
|       block_color: (_this$format4 = this.format) === null || _this$format4 === void 0 ? void 0 : _this$format4.block_color,

 @ ./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/babel-loader/lib??ref--1-1!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/pages/Dev.vue?vue&type=script&lang=js& 7:0-59 10:20-34 26:21-34
 @ ./src/pages/Dev.vue?vue&type=script&lang=js&
 @ ./src/pages/Dev.vue
 @ ./src/.temp/routes.js
 @ ./node_modules/gridsome/app/router.js
 @ ./node_modules/gridsome/app/entry.sockjs.js
 @ multi webpack/hot/dev-server webpack-hot-middleware/client?name=app&reload=true&noInfo=true ./node_modules/gridsome/app/entry.client.js ./node_modules/gridsome/app/entry.sockjs.js

It seems that the error was caused by nullish coalescing operator ?? which is not supported by the loader I'm using. When I change the ?? to ||, it works. So could you please consider this item of compatibility? Much appreciate your reply.

janniks commented 3 years ago

Hi πŸ‘‹πŸ» Thanks for the report. Yes, this seems like a good idea β€” will change today

janniks commented 3 years ago

Released in 1.0.1 via #37 πŸš€ Sorry that this took so long. I had to fix some tooling.