ts1 / flipbook-vue

3D page flip effect for Vue.js
https://ts1.github.io/flipbook-vue/
614 stars 158 forks source link

Cannot build using Vue 3 #78

Closed TMadzi closed 2 years ago

TMadzi commented 2 years ago

I am using the library with Vue 3 and the Vitesse template by Anthony Fu. I am able to use the flipbook in development mode but when I try and build I get the following error:

(node:82784) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. (Use node --trace-warnings ... to show where the warning was created)

[vite-ssg] An internal error occurred. [vite-ssg] Please report an issue, if none already exists: https://github.com/antfu/vite-ssg/issues C:\Users\tenda\Work\comic-khaya\comic-khaya\node_modules.pnpm\flipbook-vue@1.0.0-alpha.2_vue@3.2.31\node_modules\flipbook-vue\dist\flipbook.es.js:8 import { multiply, perspective, translate, translate3d, rotateY, toString, identity } from 'rematrix'; ^^^^^^

SyntaxError: Cannot use import statement outside a module at compileFunction () at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1033:15) at Module._compile (node:internal/modules/cjs/loader:1069:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at ModuleWrap. (node:internal/modules/esm/translators:170:29) at ModuleJob.run (node:internal/modules/esm/module_job:198:25) at async Promise.all (index 0)  ELIFECYCLE  Command failed with exit code 1.

I have tried adding "type": "module" to my package.json but then I get an i18tn error:

@ build C:\Users\tenda\Work\comic-khaya\comic-khaya cross-env NODE_ENV=production vite-ssg build

failed to load config from C:\Users\tenda\Work\comic-khaya\comic-khaya\vite.config.ts

[vite-ssg] An internal error occurred. [vite-ssg] Please report an issue, if none already exists: https://github.com/antfu/vite-ssg/issues file:///C:/Users/tenda/Work/comic-khaya/comic-khaya/vite.config.ts.js?t=1662095237908:12 import VueI18n from "@intlify/vite-plugin-vue-i18n"; ^^^^^^^ SyntaxError: The requested module '@intlify/vite-plugin-vue-i18n' does not provide an export named 'default' at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21) at async ModuleJob.run (node:internal/modules/esm/module_job:194:5) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:385:24) at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15) at async loadConfigFromFile (C:\Users\tenda\Work\comic-khaya\comic-khaya\node_modules.pnpm\vite@2.8.5\node_modules\vite\dist\node\chunks\dep-ff3ab196.js:71330:31) at async Object.resolveConfig (C:\Users\tenda\Work\comic-khaya\comic-khaya\node_modules.pnpm\vite@2.8.5\node_modules\vite\dist\node\chunks\dep-ff3ab196.js:70877:28) at async build (C:\Users\tenda\Work\comic-khaya\comic-khaya\node_modules.pnpm\vite-ssg@0.17.10_fyaxsbpxifbwrpzrzxa344n2li\node_modules\vite-ssg\dist\node\cli.cjs:121:18)
at async Object.handler (C:\Users\tenda\Work\comic-khaya\comic-khaya\node_modules.pnpm\vite-ssg@0.17.10_fyaxsbpxifbwrpzrzxa344n2li\node_modules\vite-ssg\dist\node\cli.cjs:314:3)  ELIFECYCLE  Command failed with exit code 1.

Thanks in advance

ts1 commented 2 years ago

I renamed ES module version of built JS to flipbook.mjs. Please try 1.0.0-alpha.4.