Skip to content

Commit 91b7998

Browse files
committed
build: update rollup config
1 parent b7066f8 commit 91b7998

File tree

4 files changed

+32
-24
lines changed

4 files changed

+32
-24
lines changed

Diff for: build/build.main.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ function build (builds) {
2626
next()
2727
}
2828

29-
function buildEntry (config) {
30-
const isProd = /min\.js$/.test(config.file)
31-
return rollup.rollup(config)
32-
.then(bundle => bundle.generate(config))
29+
function buildEntry ({ input, output }) {
30+
const isProd = /min\.js$/.test(output.file)
31+
return rollup.rollup(input)
32+
.then(bundle => bundle.generate(output))
3333
.then(({ code }) => {
3434
if (isProd) {
35-
var minified = (config.banner ? config.banner + '\n' : '') + uglify.minify(code, {
35+
var minified = (output.banner ? output.banner + '\n' : '') + uglify.minify(code, {
3636
output: {
3737
/* eslint-disable camelcase */
3838
ascii_only: true
3939
/* eslint-enable camelcase */
4040
}
4141
}).code
42-
return write(config.file, minified, true)
42+
return write(output.file, minified, true)
4343
} else {
44-
return write(config.file, code)
44+
return write(output.file, code)
4545
}
4646
})
4747
}

Diff for: build/configs.js

+16-12
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,25 @@ const configs = {
3838

3939
function genConfig (opts) {
4040
const config = {
41-
input: opts.input,
42-
file: opts.file,
43-
format: opts.format,
44-
banner,
45-
name: 'Vuex',
46-
plugins: [
47-
replace({
48-
__VERSION__: version
49-
}),
50-
buble()
51-
]
41+
input: {
42+
input: opts.input,
43+
plugins: [
44+
replace({
45+
__VERSION__: version
46+
}),
47+
buble()
48+
]
49+
},
50+
output: {
51+
banner,
52+
file: opts.file,
53+
format: opts.format,
54+
name: 'Vuex'
55+
}
5256
}
5357

5458
if (opts.env) {
55-
config.plugins.unshift(replace({
59+
config.input.plugins.unshift(replace({
5660
'process.env.NODE_ENV': JSON.stringify(opts.env)
5761
}))
5862
}

Diff for: build/rollup.dev.config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
module.exports = require('./configs').commonjs
1+
const { input, output } = require('./configs').commonjs
2+
3+
module.exports = Object.assign({}, input, { output })

Diff for: build/rollup.logger.config.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
const buble = require('rollup-plugin-buble')
22

33
module.exports = {
4-
entry: 'src/plugins/logger.js',
5-
dest: 'dist/logger.js',
6-
format: 'umd',
7-
moduleName: 'createVuexLogger',
4+
input: 'src/plugins/logger.js',
5+
output: {
6+
file: 'dist/logger.js',
7+
format: 'umd',
8+
name: 'createVuexLogger',
9+
},
810
plugins: [buble()]
911
}

0 commit comments

Comments
 (0)