janniks / vue-notion

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

1.4.4 | 1.5.0 introduce new Module parse failed #126

Open MkLHX opened 1 year ago

MkLHX commented 1 year ago

node v16.15 vuejs@2.7.14 vue-notion@1.4.4

To find a solution to #121 I try to update vuejs@2.7.14 and use vue-notion@1.4.4

The result is a new error about Module parse.


 ERROR  Failed to compile with 1 error                                                                                                                                16:09:27

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

Module parse failed: Unexpected token (16:31)
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
|   let index = -1;
|   Object.keys(blockMap).forEach(id => {
>     blockMap[id].value.content?.forEach(blockId => {
|       const blockType = blockMap[blockId]?.value?.type;
|       if (blockType && blockType !== lastType) {

 @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/components/WaterPump/PumpCalibration/PumpCalibrationDialog/TutorialItem.vue?vue&type=script&lang=js& 1:0-59 5:4-18 23:26-39   
 @ ./src/components/WaterPump/PumpCalibration/PumpCalibrationDialog/TutorialItem.vue?vue&type=script&lang=js&
 @ ./src/components/WaterPump/PumpCalibration/PumpCalibrationDialog/TutorialItem.vue
 @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/components/WaterPump/PumpCalibration/PumpCalibrationDialog/PumpCalibrationDialog.vue?vue&type=script&lang=js&
 @ ./src/components/WaterPump/PumpCalibration/PumpCalibrationDialog/PumpCalibrationDialog.vue?vue&type=script&lang=js&
 @ ./src/components/WaterPump/PumpCalibration/PumpCalibrationDialog/PumpCalibrationDialog.vue
 @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/components/WaterPump/WaterPumpBlock/WaterPumpBloc.vue?vue&type=script&lang=js&
 @ ./src/components/WaterPump/WaterPumpBlock/WaterPumpBloc.vue?vue&type=script&lang=js&
 @ ./src/components/WaterPump/WaterPumpBlock/WaterPumpBloc.vue
 @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/views/WaterPumpsView.vue?vue&type=script&lang=js&
 @ ./src/views/WaterPumpsView.vue?vue&type=script&lang=js&
 @ ./src/views/WaterPumpsView.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.0.68:8081&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

Each object key looking like blockMap[id].value.content?.forEach cannot be parsed because the ? on the key content.

When I remove all the ? and fix syntax the module can be parsed and built.

So I don't know what happened with the syntax but vuejs2.7.14 is still not compatible.

janniks commented 1 year ago

Thanks for all the logs -- could you try updating to 1.5.1 ? 📦

MkLHX commented 1 year ago

Thanks for providing releases so quickly!

build was executed but with a warning :

warning  in ./node_modules/vue-notion/dist/esm.js
Module not found: Error: Can't resolve 'encoding' in '<my_project_path>\node_modules\vue-notion\dist'

and of course Notion page wasn't rendered now.

janniks commented 1 year ago

Hmm, not sure about this one -- Maybe try installing the encoding npm package (i see it's a peerDep from node-fetch via cross-fetch in the package lockfile). Might also help to remove node_modules and (e.g. nuxt) cache and npm install again.

MkLHX commented 1 year ago

The issue seems to be from my project because on this project with 1.4.3 or 1.5.1 the Notion page is rendered correctly.

https://github.com/MkLHX/vue_notion_test_project

I'm going to push research about what provides the issue on my side.

Maybe an idea: the historical project was built with vue-cli@4.5 and the test project with vue-cli@5.0.4