Skip to content

Commit

Permalink
fix: sideEffects not working
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Dec 6, 2022
1 parent 4c0ecab commit 87d567e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface VitePluginOptions {
hash?: boolean
/**
* @description treat `input` as sideEffect or not
* @default false
* @see https://esbuild.github.io/api/#tree-shaking-and-side-effects
*/
sideEffects?: boolean
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function build(options: BuildOptions) {

const { plugins = [], ...rest } = esbuildOptions

const esbuildPlugins = sideEffects ? [noSideEffectsPlugin, ...plugins] : plugins
const esbuildPlugins = sideEffects ? plugins : [noSideEffectsPlugin, ...plugins]

let res: BuildResult
try {
Expand Down

0 comments on commit 87d567e

Please sign in to comment.