farm-fe / farm

Extremely fast Vite-compatible web build tool written in Rust
https://farmfe.org
MIT License
4.8k stars 160 forks source link

[Bug Report]: Can't be used with sentry-vite-plugin or unplugin-vite/sentry #1496

Open spikecodes opened 2 months ago

spikecodes commented 2 months ago

I saw https://www.farmfe.org/docs/plugins/community-plugins/#unplugin said sentry-javascript-bundler-plugins is supported but couldn't use it without errors.

Steps to reproduce

  1. Start a new farm project
  2. Init Sentry in the Farm Config:
    export default defineConfig({
    vitePlugins: [
    () => ({
      vitePlugin: sentryVitePlugin({
        org: <ORG_NAME>,
        project: <PROJECT_NAME>,
      }),
      filters: ['\\.tsx$', '\\.jsx$']
    })
    ],
    //...
    }

Log of Errors

image

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-13620H
    Memory: 4.07 GB / 15.62 GB
  Binaries:
    Node: 22.2.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
    bun: 1.1.17 - C:\Program Files\nodejs\bun.CMD
  Browsers:
    Edge: Chromium (126.0.2592.81)
    Internet Explorer: 11.0.22621.3527

Further https://www.farmfe.org/docs/plugins/community-plugins/#unplugin said unplugin-sentry is supported but I got this message:

[ Farm ] Failed to start the server: 
 Error: Vite plugin 'unplugin-sentry' is not compatible with Farm for now. Because it uses viteConfig['env'] which is not supported by Farm.
Current supported keys are: root,base,publicDir,mode,define,command,resolve,plugins,server,isProduction,css,build,logger,cacheDir,envDir,assetsInclude,legacy,optimizeDeps,ssr,logLevel,experimental,test,clearScreen,customLogger
wre232114 commented 2 months ago

we'll make farm compatible with this vite plugins this week

Micnubinub commented 1 month ago

@wre232114 any update on this? Still getting the issue on:

"@farmfe/cli": "1.0.3",
"@farmfe/core": "1.3.11",
"@farmfe/js-plugin-postcss": "1.8.0",
"@farmfe/plugin-react": "1.2.0",
shulandmimi commented 1 month ago

When using @sentry/vite-plugin, try adding "sentry-release-injection-file" to filters or setting filters to [".+"]

If you get TypeError: Cannot read properties of undefined (reading 'targetMinSize'), set complation.partialBundling to {}, we will fix it later

import { defineConfig } from '@farmfe/core';
import { sentryVitePlugin } from '@sentry/vite-plugin';

export default defineConfig({
    // ...
    compilation: {
        partialBundling: {},
    },
    vitePlugins: [
        () => ({
            vitePlugin: sentryVitePlugin({
                // ...
            }),
            filters: ['\\.tsx$', '\\.jsx$', 'sentry-release-injection-file'],
            // or
            filters: ['.+'],
        }),
    ],
});