Skip to content

Commit

Permalink
feat(rollup): init format
Browse files Browse the repository at this point in the history
  • Loading branch information
xuasir committed Feb 4, 2021
1 parent 40fe3dc commit ac2c01b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/cli-plugin-bundler-rollup/src/rollupManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { IRollupChain, AllConfigs } from './rollupChian'
import type { ChainFn, RollupPluginConfig, CompileTargets } from './types'
import { Target2Format } from './types'
import { rollup } from 'rollup'
import { warn, logWithSpinner, stopSpinner } from '@xus/cli'
import RollupChain from './rollupChian'
Expand All @@ -13,7 +14,29 @@ class RollupManager {

constructor() {
this.rollupChain = new RollupChain()
this.initFormat()
}

initFormat() {
this.rollupChain
.when('esm-browser')
.output.format(Target2Format['esm-browser'])
.end()
.end()
.when('esm-bundler')
.output.format(Target2Format['esm-bundler'])
.end()
.end()
.when('global')
.output.format(Target2Format['global'])
.end()
.end()
.when('node')
.output.format(Target2Format['node'])
.end()
.end()
}

// for plugin user
setup(pluginConfig: RollupPluginConfig) {
// merge to default
Expand Down

0 comments on commit ac2c01b

Please sign in to comment.