Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/vite/src/node/optimizer/rolldownDepPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,14 @@ export function rolldownCjsExternalPlugin(
if (platform === 'node') {
return undefined
}
// Skip this plugin for `platform: 'neutral'` as we are not sure whether `require` is available
if (platform === 'neutral') {
return undefined
}

// Apply this plugin for `platform: 'browser'` as `require` is not available in browser and
// converting to `import` would be necessary to make the code work
platform satisfies 'browser' | 'neutral'
platform satisfies 'browser'

const filter = new RegExp(externals.map(matchesEntireLine).join('|'))

Expand Down
Loading