Skip to content

Commit 8159d38

Browse files
Using rollup in dedicated folder
1 parent 671f99a commit 8159d38

File tree

6 files changed

+63
-70
lines changed

6 files changed

+63
-70
lines changed

build/rollup.config.base.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import resolve from 'rollup-plugin-node-resolve'
2+
import commonjs from 'rollup-plugin-commonjs'
3+
import babel from 'rollup-plugin-babel'
4+
5+
export default {
6+
input: 'src/main.js',
7+
output: {
8+
name: 'JsonApiResponseConverter',
9+
exports: 'named'
10+
},
11+
plugins: [
12+
resolve(),
13+
commonjs(),
14+
babel({
15+
exclude: 'node_modules/**'
16+
})
17+
]
18+
}

build/rollup.config.browser.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import base from './rollup.config.base'
2+
import { terser } from 'rollup-plugin-terser'
3+
import pkg from '../package.json'
4+
5+
const config = Object.assign({}, base, {
6+
output: {
7+
file: pkg.unpkg,
8+
format: 'iife',
9+
...base.output
10+
}
11+
})
12+
13+
config.plugins.push(terser())
14+
15+
export default config

build/rollup.config.es.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import base from './rollup.config.base'
2+
import pkg from '../package.json'
3+
4+
const config = Object.assign({}, base, {
5+
output: {
6+
file: pkg.module,
7+
format: 'es',
8+
...base.output
9+
}
10+
})
11+
12+
export default config

build/rollup.config.umd.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import base from './rollup.config.base'
2+
import pkg from '../package.json'
3+
4+
const config = Object.assign({}, base, {
5+
output: {
6+
file: pkg.main,
7+
format: 'umd',
8+
...base.output
9+
}
10+
})
11+
12+
export default config

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "json-api-response-converter",
33
"version": "1.4.0",
4-
"main": "dist/json-api-response-converter.js",
5-
"browser": "dist/json-api-response-converter.umd.js",
4+
"main": "dist/json-api-response-converter.umd.js",
65
"module": "dist/json-api-response-converter.es.js",
6+
"unpkg": "dist/json-api-response-converter.min.js",
77
"repository": "git@github.com:guillaumebriday/json-api-response-converter.git",
88
"author": "Guillaume Briday <guillaumebriday@gmail.com>",
99
"homepage": "https://github.com/guillaumebriday/json-api-response-converter",
@@ -16,7 +16,10 @@
1616
"scripts": {
1717
"lint": "eslint --ext .js --ignore-path .gitignore .",
1818
"test": "BABEL_ENV=test jest",
19-
"build": "BABEL_ENV=build rollup -c",
19+
"build:browser": "rollup -c build/rollup.config.browser.js",
20+
"build:es": "rollup -c build/rollup.config.es.js",
21+
"build:umd": "rollup -c build/rollup.config.umd.js",
22+
"build": "yarn build:browser && yarn build:es && yarn build:umd",
2023
"prepublishOnly": "yarn build"
2124
},
2225
"devDependencies": {

rollup.config.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)