-
-
Notifications
You must be signed in to change notification settings - Fork 189
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Steps to reproduce
npm run build
Reproduce link
No response
What is actually happening?
import { defineConfig } from '@farmfe/core';
// import farmPostcssPlugin from '@farmfe/js-plugin-postcss';
import farmLessPlugin from '@farmfe/js-plugin-less';
import farmJsPluginSvgr from '@farmfe/js-plugin-svgr';
import strip from '@farmfe/plugin-strip';
import * as path from 'node:path';
import { TanStackRouterVite } from '@tanstack/router-plugin/vite';
import antdLess from './antd-less';
export default defineConfig({
compilation: {
input: {
index: './src/index.html'
},
output: {
path: 'dist',
publicPath: '/',
targetEnv: 'browser',
filename: 'static/[ext]/[name]_[hash].[ext]',
assetsFilename: 'images/[name].[ext]'
},
resolve: {
alias: {
"@/": path.join(process.cwd(), "src"),
},
},
external: ["node:fs"],
sourcemap: process.env.NODE_ENV === 'development' ? 'all' : false,
define: {
SYSTEM_CONTEXT_PATH: process.env.FARM_SYSTEM_CONTEXT_PATH,
},
runtime: {
isolate: true,
}
},
server: {
port: 9000,
proxy: {
'/api/': {
target: 'http://127.0.0.1:8081',
changeOrigin: true,
pathRewrite: { '^': '' },
},
'/system/': {
target: 'http://127.0.0.1:8081',
changeOrigin: true,
pathRewrite: { '^': '' },
on: {
proxyReq: (proxyReq, req, res, options) => {
if (req.headers?.accept?.startsWith('text/event-stream')) {
res.setHeader('location', options.target! + req.url!);
}
},
}
},
}
},
envDir: 'env',
plugins: [
[
'@farmfe/plugin-react',
{
refresh: process.env.NODE_ENV === 'development',
development: process.env.NODE_ENV === 'development',
runtime: "automatic",
}
],
['@farmfe/plugin-sass', {
sourceMap: true, // bool
sourceMapIncludeSources: true, // bool
alertAscii: true, // bool
alertColor: true, // bool
charset: true, // bool
quietDeps: true, // bool
verbose: false, // bool
style: 'expanded',// 'expanded' | 'compressed' // output code style
}],
farmLessPlugin({
lessOptions: {
modifyVars: antdLess.v5Vars,
}
}),
farmJsPluginSvgr({
svgrOptions: {
// loadPaths: [path.resolve(process.cwd())],
},
filters: {
resolvedPaths: ['src/.*/.*\\.svg$'],
},
}),
],
vitePlugins: [
TanStackRouterVite({
target: 'react',
routesDirectory: 'src/routes/',
autoCodeSplitting: false,
// virtualRouteConfig: routes,
}),
]
});file env/.env:
FARM_SYSTEM_CONTEXT_PATH=
file env/.env.development:
FARM_SYSTEM_CONTEXT_PATH=http://127.0.0.1:8081
file env/.env.production:
FARM_SYSTEM_CONTEXT_PATH=
failed log:
[ Farm ] Using config file at D:\workspace\xxx\farm.config.ts
♻️ Generating routes...
✅ Processed routes in 322ms
thread '<unnamed>' panicked at crates\node\src\lib.rs:135:8:
can not transform js config object to rust config: Error { status: InvalidArg, reason: "data did not match any variant of untagged enum PersistentCacheConfig", maybe_raw: 0x0 }
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
If I delete the define configuration and then execute npm run build, the compilation will be normal
System Info
System:
OS: Windows 11 10.0.26200
CPU: (24) x64 AMD Ryzen 9 3900XT 12-Core Processor
Memory: 26.82 GB / 63.93 GB
Binaries:
Node: 22.11.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
npm: 10.9.1 - ~\AppData\Roaming\npm\npm.CMD
pnpm: 8.10.2 - ~\AppData\Roaming\npm\pnpm.CMD
bun: 1.1.0 - ~\.bun\bin\bun.EXE
Browsers:
Edge: Chromium (136.0.3240.14), ChromiumDev (137.0.3255.0)
Internet Explorer: 11.0.26100.1
npmPackages:
@farmfe/core: ^1.7.5 => 1.7.5Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working