ionic-team / pwa-elements

Quality UI experiences for Web APIs that require custom UI (such as media/camera).
https://medium.com/@maxlynch/building-the-progressive-web-app-os-57daebcb69c1
MIT License
168 stars 50 forks source link

Persistent deploy error on Vercel #133

Open nelsonvassalo opened 5 months ago

nelsonvassalo commented 5 months ago

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request

Current behavior: When deploying a production build to Vercel, the plugin causes it to fail every time. The reason is that the repo is marked as type: module to accept ESModules but it seems the package is using CommonJS.

Expected behavior: A repo can build on production in Vercel.

Steps to reproduce: Any code push produces a deployment that fails.

Related code: package.json

"dependencies": {
    "svelte": "^4.2.7",
    "svelte-preprocess": "^5.1.4",
    "tailwindcss": "^3.4.3",
    "vite": "^5.0.3",
    "@sveltejs/kit": "^2.0.0",
    "@sveltejs/vite-plugin-svelte": "^3.1.0",
    "@capacitor/android": "^6.0.0",
    "@capacitor/camera": "^6.0.0",
    "@capacitor/cli": "^6.0.0",
    "@capacitor/core": "^6.0.0",
    "@capacitor/geolocation": "^6.0.0",
    "@capacitor/ios": "^6.0.0",
    "@capacitor/motion": "^6.0.0",
    "@capacitor/preferences": "^6.0.1",
    "@ionic/pwa-elements": "^3.2.2",
    "@sveltejs/adapter-static": "^3.0.1",
    "maplibre-gl": "^4.4.0",
    "rollup": "^4.17.2"
    }

Build log:

/vercel/path0/node_modules/@ionic/pwa-elements/dist/esm/loader.js:1
import { p as promiseResolve, b as bootstrapLazy } from './index-1c5c47b4.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:128:18)
    at wrapSafe (node:internal/modules/cjs/loader:1280:20)
    at Module._compile (node:internal/modules/cjs/loader:1332:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at cjsLoader (node:internal/modules/esm/translators:366:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:315:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:326:10)
    at [kOnMessage] (node:internal/worker:337:37)
    at MessagePort.<anonymous> (node:internal/worker:232:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:826:20)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)