Skip to content

Commit fee8834

Browse files
author
Javier Diaz
committed
chore: build library config
1 parent 7dccb1d commit fee8834

File tree

3 files changed

+280
-12
lines changed

3 files changed

+280
-12
lines changed

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
"license": "MIT",
1010
"private": false,
1111
"scripts": {
12-
"build": "vue-cli-service build --target lib --name VueTinyPagination index.js",
12+
"build": "rollup --config rollup.config.js",
1313
"lint": "vue-cli-service lint",
1414
"test:unit": "vue-cli-service test:unit",
1515
"prepare": "yarn test:unit && yarn build"
1616
},
17+
"main": "dist/vue-tiny-pagination.umd.js",
18+
"module": "dist/vue-tiny-pagination.esm.js",
19+
"unpkg": "dist/vue-tiny-pagination.min.js",
1720
"repository": {
1821
"type": "git",
1922
"url": "git+https://github.com/coderdiaz/vue-tiny-pagination.git"
@@ -45,6 +48,9 @@
4548
"babel-core": "7.0.0-bridge.0",
4649
"babel-jest": "^23.0.1",
4750
"node-sass": "^4.9.0",
51+
"rollup": "^1.8.0",
52+
"rollup-plugin-commonjs": "^9.2.3",
53+
"rollup-plugin-vue": "^4.7.2",
4854
"sass-loader": "^7.0.1",
4955
"vue-template-compiler": "^2.5.17"
5056
}

rollup.config.js

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import vue from 'rollup-plugin-vue';
2+
import commonjs from 'rollup-plugin-commonjs';
3+
4+
export default [
5+
// ESM build to be used with webpack/rollup.
6+
{
7+
input: 'index.js',
8+
output: {
9+
format: 'esm',
10+
file: 'dist/vue-tiny-pagination.esm.js',
11+
},
12+
plugins: [
13+
vue(),
14+
commonjs(),
15+
],
16+
},
17+
// UMD build.
18+
{
19+
input: 'index.js',
20+
output: {
21+
name: 'VueTinyPagination',
22+
format: 'umd',
23+
file: 'dist/vue-tiny-pagination.umd.js',
24+
},
25+
plugins: [
26+
vue(),
27+
commonjs(),
28+
],
29+
},
30+
// SSR build.
31+
{
32+
input: 'index.js',
33+
output: {
34+
format: 'cjs',
35+
file: 'dist/vue-tiny-pagination.ssr.js',
36+
},
37+
plugins: [
38+
vue({ template: { optimizeSSR: true } }),
39+
commonjs(),
40+
],
41+
},
42+
// Browser build.
43+
{
44+
input: 'index.js',
45+
output: {
46+
name: 'VueTinyPagination',
47+
format: 'iife',
48+
file: 'dist/vue-tiny-pagination.min.js',
49+
},
50+
plugins: [
51+
vue(),
52+
commonjs(),
53+
],
54+
},
55+
];

0 commit comments

Comments
 (0)