Skip to content

Commit

Permalink
fix: avoid rollup options being passed to vite plugin (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Apr 14, 2022
1 parent 6dae10c commit 8e408a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/rollup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function getRollupPlugin <UserOptions = {}> (
}
}

export function toRollupPlugin (plugin: UnpluginOptions): RollupPlugin {
export function toRollupPlugin (plugin: UnpluginOptions, containRollupOptions = true): RollupPlugin {
if (plugin.transform && plugin.transformInclude) {
const _transform = plugin.transform
plugin.transform = function (code, id) {
Expand All @@ -23,7 +23,7 @@ export function toRollupPlugin (plugin: UnpluginOptions): RollupPlugin {
}
}

if (plugin.rollup) {
if (plugin.rollup && containRollupOptions) {
Object.assign(plugin, plugin.rollup)
}

Expand Down
2 changes: 1 addition & 1 deletion src/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getVitePlugin <UserOptions = {}> (
}
const rawPlugin = factory(userOptions, meta)

const plugin = toRollupPlugin(rawPlugin) as VitePlugin
const plugin = toRollupPlugin(rawPlugin, false) as VitePlugin

if (rawPlugin.vite) {
Object.assign(plugin, rawPlugin.vite)
Expand Down

0 comments on commit 8e408a3

Please sign in to comment.