Skip to content

Commit cd7b55a

Browse files
committed
Add cjs build
1 parent 761b684 commit cd7b55a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
yarn-error.log
3+
dist

rollup.config.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@ function createEntry(options) {
2323
plugins: [],
2424
output: {
2525
banner,
26-
file: 'dist/vue-router.other.js',
26+
file: 'dist/vue-test-utils.other.js',
2727
format
2828
}
2929
}
3030

3131
if (format === 'es') {
3232
config.output.file = isBrowser ? pkg.browser : pkg.module
3333
}
34+
if (format === 'cjs') {
35+
config.output.file = pkg.main
36+
}
3437
console.log('file is', config.output.file)
3538

3639
config.plugins.push(
@@ -39,7 +42,8 @@ function createEntry(options) {
3942
tsconfigOverride: {
4043
compilerOptions: {
4144
declaration: format === 'es' && isBrowser,
42-
target: 'es6' // not sure what this should be?
45+
target: 'es5', // not sure what this should be?
46+
module: format === 'cjs' ? 'es2015' : 'esnext'
4347
},
4448
exclude: ['tests']
4549
}
@@ -52,4 +56,5 @@ function createEntry(options) {
5256
export default [
5357
createEntry({ format: 'es', input: 'src/index.ts', isBrowser: false }),
5458
createEntry({ format: 'es', input: 'src/index.ts', isBrowser: true }),
59+
createEntry({ format: 'cjs', input: 'src/index.ts', isBrowser: false }),
5560
]

0 commit comments

Comments
 (0)