Skip to content

Commit

Permalink
Merge pull request #235 from zigomir/browser-es-build
Browse files Browse the repository at this point in the history
Add ESM browser build
  • Loading branch information
lmiller1990 committed Nov 5, 2020
2 parents a657245 + f99a7d6 commit d6e1ac8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ function createEntry(options) {
isBrowser
} = options

const isEsmBrowser = format === 'es' && isBrowser

const config = {
input,
external: [
'vue',
'@vue/compiler-dom',
isEsmBrowser ? '@vue/compiler-dom/dist/compiler-dom.esm-browser' : '@vue/compiler-dom',
],
plugins: [
replace({
Expand All @@ -47,6 +49,9 @@ function createEntry(options) {

if (format === 'es') {
config.output.file = pkg.module
if (isBrowser) {
config.output.file = 'dist/vue-test-utils.esm-browser.js'
}
}
if (format === 'cjs') {
config.output.file = pkg.main
Expand All @@ -72,6 +77,7 @@ function createEntry(options) {

export default [
createEntry({ format: 'es', input: 'src/index.ts', isBrowser: false }),
createEntry({ format: 'es', input: 'src/index.ts', isBrowser: true }),
createEntry({ format: 'iife', input: 'src/index.ts', isBrowser: true }),
createEntry({ format: 'cjs', input: 'src/index.ts', isBrowser: false }),
]

0 comments on commit d6e1ac8

Please sign in to comment.