spatie / flare-vite-plugin-sourcemap-uploader

A Vite plugin for uploading sourcemaps to Flare
https://flareapp.io
MIT License
2 stars 2 forks source link

TypeError: flareSourcemapUploader is not a function #4

Closed glennmichael123 closed 6 months ago

glennmichael123 commented 1 year ago

When I tried using this function inside the plugin it throws this error

failed to load config from vite.config.ts error when starting dev server: TypeError: flareSourcemapUploader is not a function at vite.config.ts.timestamp-1679534839280.mjs:37:5 at ModuleJob.run (node:internal/modules/esm/module_job:194:25) ELIFECYCLE  Command failed with exit code 1.

Here is the code in question:

import flareSourcemapUploader from '@flareapp/vite-plugin-sourcemap-uploader'

export default defineConfig({
resolve: {
   alias: {
     '~/': `${path.resolve(__dirname, 'src')}/`,
   },
 },
clearScreen: false,

server: {
    port: 3333,
    strictPort: true,
},
plugins: [
    flareSourcemapUploader({
      key: loadEnv('mock', process.cwd(), '').VITE_FLAREAPP_KEY,
    })
]
pnpm version: 7.30.0
node version: v18.15.0
vite version: ^4.1.2
rswfire commented 1 year ago

I have this same issue.

vc-ryan commented 1 year ago

Same issue here, anyone have a solution? Logging shows it is a function { default: [Function: flareSourcemapUploader] }.

a4anthony commented 1 year ago

This worked for me.

flareSourcemapUploader.default({ key: "Public key here" })

chrispage1 commented 1 year ago

Same issue! Thanks to @a4anthony for a workaround

Sam-Apostel commented 1 year ago

This issue indicates a problem with our build step. using .default is a workaround at best, which might not work after building your project to a different target and isn't compatible with typescript types.

I'll look into finding a more reliable package building tool.

glennmichael123 commented 1 year ago

@Sam-Apostel Thank you for looking into this as this issue has swayed me from using Flare with Vite configs.

salvisb commented 11 months ago

The same here. @Sam-Apostel do we have an ETA on a proper fix? Thanks!

MikeCraig418 commented 10 months ago

Hello -- I ran into this today, too:

TypeError: flareSourcemapUploader is not a function.

I'm using Vite. Here's my package.json:

{
    "private": true,
    "type": "module",
    "scripts": {
        "dev": "vite",
        "build": "vite build"
    },
    "devDependencies": {
        "@tailwindcss/forms": "^0.5.6",
        "@tailwindcss/typography": "^0.5.10",
        "alpinejs": "^3.10.5",
        "autoprefixer": "^10.4.16",
        "axios": "^0.25",
        "jquery-ui": "^1.13.2",
        "laravel-mix": "^6.0.6",
        "laravel-vapor": "^0.6.0",
        "laravel-vite-plugin": "^0.7.8",
        "lodash": "^4.17.19",
        "postcss": "^8.4.31",
        "postcss-import": "^12.0.1",
        "tailwindcss": "^3.3.3",
        "tippy.js": "^6.3.7",
        "vite": "^4.4.9"
    },
    "dependencies": {
        "@flareapp/flare-client": "^3.0.5",     // 👈
        "@flareapp/vite-plugin-sourcemap-uploader": "^1.0.3", // 👈
        "bootstrap-select": "^1.13.18",
        "medium-editor": "^5.23.3",
        "tw-elements": "^1.0.0-beta2"
    },
    "description": "```bash\r cp .env.example .env",
    "version": "1.0.0",
    "main": "tailwind.config.js",
    "directories": {
        "test": "tests"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
}

I'm using flareSourcemapUploader.default({ key: "Public key here" }) as a workaround for now.

spatie-bot commented 6 months ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.