fix(bridge): resolve browser condition above main for client (#641)

This commit is contained in:
Daniel Roe 2021-10-04 22:25:27 +02:00 committed by GitHub
parent 5d86bfad78
commit d51ed1e6aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,8 +10,7 @@ type ResolverOptions = Omit<UserResolveOptions, 'fileSystem'> & { fileSystem?: e
const DEFAULTS: UserResolveOptions = {
fileSystem: new enhancedResolve.CachedInputFileSystem(fs, 4000),
extensions: ['.ts', '.mjs', '.cjs', '.js', '.json'],
mainFields: ['module', 'main']
extensions: ['.ts', '.tsx', '.mjs', '.cjs', '.js', '.jsx', '.json', '.vue']
}
// Abstracted resolver factory which can be used in rollup, webpack, etc.
@ -69,6 +68,7 @@ export function setupBetterResolve () {
config.resolve.plugins.push(new EnhancedResolverPlugin({
conditionNames: ['import', ...isServer ? ['node'] : []],
mainFields: ['module', ...isServer ? [] : ['browser'], 'main'],
alias: config.resolve.alias,
modules: config.resolve.modules,
plugins: config.resolve.plugins as Array<Exclude<ResolveOptions['plugins'][number], string>>,