Closed Rajaniraiyn closed 3 days ago
We'll support it later
I was trying to migrate all our projects from vite to farm today and seen that resolve-alias
is unsupported.
https://vitejs.dev/config/shared-options.html#resolve-alias
there is my ferm.config
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import * as path from 'path';
import Components from 'unplugin-vue-components/vite';
import { BootstrapVueNextResolver } from 'unplugin-vue-components/resolvers';
// https://vitejs.dev/config/
export default defineConfig({
base: process.env.E2E ? '/' : '/route/sms',
plugins: [
vue(),
Components({
resolvers: [BootstrapVueNextResolver()],
}),
// commonjs(),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 8889,
},
define: {
// enable hydration mismatch details in production build
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'true',
},
// @ts-expect-error defineConfig of vite not contain vitest type
test: {
setupFiles: ['vitest-localstorage-mock'],
mockReset: false,
include: ['src/**/*.spec.{ts,js}'],
},
});
and error
[ Farm ] Error: Failed to load config file: Validation error: Unrecognized key(s) in object: 'base', 'resolve', 'define', 'test'.
Please check your configuration file or command line configuration.
so there are other keys that are available in vite but not supported here.
Maybe it would be useful to write about partial compatibility and create detailed table with status of vite options support.
@gustawdaniel-statscore
the first point
The configuration in farm is wrapped in compilation except for server and plugin and some env configurations
trans base
to compilation: { output: { publicPath: "" } }
define
and resolve
same like point 2, put their in compilation
no test
config
We'll be supporting this later.
@wre232114 Is there any roadmap or timeline for this feature?
it will be supported this week, you can use resolve.alias as work-around for now
Thank you so much
@wre232114 any updates on this?
@Rajaniraiyn Sorry, due to some other work reasons, we will implement this feature this week
What problem does this feature solve?
In certain React projects, multiple React-specific packages may enforce different versions of React, leading to version mismatches and resulting in compilation errors. This problem often occurs when various packages reference different React versions, causing conflicts and inconsistent behavior during project compilation.
This feature aims to provide a solution by enforcing a unified version of React within the project, preventing version mismatch errors. This can be particularly beneficial in complex React projects where dependency management is crucial.
For reference, see Vite’s config options: Vite Config - Resolve Dedupe.
What does the proposed API look like?
this config option should be part of existing
ResolveOptions
as follows