Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only handle merge ssr.noExternal #8003

Merged
merged 1 commit into from May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions packages/vite/src/node/__tests__/config.spec.ts
Expand Up @@ -157,6 +157,30 @@ describe('mergeConfig', () => {

expect(mergeConfig(baseConfig, newConfig)).toEqual(mergedConfig)
})

test('handles ssr.noExternal', () => {
const baseConfig = {
ssr: {
noExternal: true
}
}

const newConfig = {
ssr: {
noExternal: ['foo']
}
}

const mergedConfig = {
ssr: {
noExternal: true
}
}

// merging either ways, `ssr.noExternal: true` should take highest priority
expect(mergeConfig(baseConfig, newConfig)).toEqual(mergedConfig)
expect(mergeConfig(newConfig, baseConfig)).toEqual(mergedConfig)
})
})

describe('resolveConfig', () => {
Expand Down
6 changes: 5 additions & 1 deletion packages/vite/src/node/config.ts
Expand Up @@ -745,7 +745,11 @@ function mergeConfigRecursively(
} else if (key === 'assetsInclude' && rootPath === '') {
merged[key] = [].concat(existing, value)
continue
} else if (key === 'noExternal' && (existing === true || value === true)) {
} else if (
key === 'noExternal' &&
rootPath === 'ssr' &&
(existing === true || value === true)
) {
merged[key] = true
continue
}
Expand Down