janniks / vue-notion

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

[nuxt] [request error] [unhandled] [500] Named export 'getPageBlocks' not found. #141

Open spyderdsn opened 8 months ago

spyderdsn commented 8 months ago
[3:26:14 PM]  ERROR  [nuxt] [request error] [unhandled] [500] Named export 'getPageBlocks' not found. The requested module 'file:///Users/user/website/node_modules/vue-notion/dist/vue-notion.umd.cjs' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'file:///Users/user/website/node_modules/vue-notion/dist/vue-notion.umd.cjs';
const { getPageBlocks, getPageTable } = pkg;

  at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)  
  at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

[3:26:14 PM]  ERROR  [nuxt] [request error] [unhandled] [500] Named export 'getPageBlocks' not found. The requested module 'file:///Users/user/website/node_modules/vue-notion/dist/vue-notion.umd.cjs' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'file:///Users/user/website/node_modules/vue-notion/dist/vue-notion.umd.cjs';
const { getPageBlocks, getPageTable } = pkg;

  at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)  
  at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

[3:26:14 PM]  ERROR  [nuxt] [request error] [unhandled] [500] Named export 'getPageBlocks' not found. The requested module 'file:///Users/user/website/node_modules/vue-notion/dist/vue-notion.umd.cjs' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'file:///Users/user/website/node_modules/vue-notion/dist/vue-notion.umd.cjs';
const { getPageBlocks, getPageTable } = pkg;

  at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)  
  at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

[3:26:14 PM]  ERROR  [nuxt] [request error] [unhandled] [500] Named export 'getPageBlocks' not found. The requested module 'file:///Users/user/website/node_modules/vue-notion/dist/vue-notion.umd.cjs' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'file:///Users/user/website/node_modules/vue-notion/dist/vue-notion.umd.cjs';
const { getPageBlocks, getPageTable } = pkg;

  at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)  
  at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

  ├─ / (36ms)                                                                                                                                                                                                                                                 nitro 3:26:14 PM
  │ └── Error: [500] 
  ├─ /work (34ms)                                                                                                                                                                                                                                             nitro 3:26:14 PM
  │ └── Error: [500] 
  ├─ /200.html (32ms)                                                                                                                                                                                                                                         nitro 3:26:14 PM
  ├─ /404.html (32ms)                                                                                                                                                                                                                                         nitro 3:26:14 PM
                                                                                                                                                                                                                                                              nitro 3:26:14 PM
Errors prerendering:
  ├─ / (36ms)                                                                                                                                                                                                                                                 nitro 3:26:14 PM
  │ └── Error: [500] 
  ├─ /work (34ms)                                                                                                                                                                                                                                             nitro 3:26:14 PM
  │ └── Error: [500] 
                                                                                                                                                                                                                                                              nitro 3:26:14 PM

 ERROR  Exiting due to prerender errors.                                                                                                                                                                                                                            3:26:14 PM

  at prerender (node_modules/nitropack/dist/shared/nitro.0a84349b.mjs:216:11)
  at async node_modules/nuxt/dist/index.mjs:2992:7
  at async build (node_modules/nuxt/dist/index.mjs:4389:5)
  at async Object.run (node_modules/nuxi/dist/chunks/build.mjs:98:5)
  at async Object.run (node_modules/nuxi/dist/chunks/generate.mjs:59:5)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1648:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1773:7) 

 ERROR  Exiting due to pretender errors.   

I'm running into this error when I run "generate": "nuxt generate". "nuxt dev" works fine.

Nuxt 3.8.2 with Nitro 2.8.1
Using Nitro server preset: static
vite v4.5.0 building for production...

spyderdsn commented 8 months ago

import VueNotion, { getPageBlocks, getPageTable } from "vue-notion";

VS Code Note in the plugin file:

Could not find a declaration file for module 'vue-notion'. '/Users/user/website/node_modules/vue-notion/dist/vue-notion.umd.cjs' implicitly has an 'any' type.
  Try `npm i --save-dev @types/vue-notion` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue-notion';`ts(7016)
module "/Users/user/website/node_modules/vue-notion/dist/vue-notion.umd"

Screenshot 2023-12-04 at 3 45 32 pm

spyderdsn commented 8 months ago

Adding:

build: { transpile: ["vue-notion"], },

to the nuxt.config.ts fixes the issue.