File tree Expand file tree Collapse file tree 3 files changed +30
-16
lines changed Expand file tree Collapse file tree 3 files changed +30
-16
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 6
6
"browser" : " dist/fetch-browser.js" ,
7
7
"main" : " fetch-node.js" ,
8
8
"scripts" : {
9
- "prepublish" : " RU_ENV =production npm run build && npm test" ,
9
+ "prepublish" : " NODE_ENV =production npm run build && npm test" ,
10
10
"prepush" : " npm test" ,
11
- "build" : " npm run build:polyfill && npm run build:ponyfill" ,
12
- "build:polyfill" : " RU_TYPE=polyfill rollup -c" ,
13
- "build:ponyfill" : " RU_TYPE=ponyfill rollup -c" ,
11
+ "build" : " rollup -c" ,
14
12
"test" : " npm run lint && npm run mocha" ,
15
13
"mocha" : " mocha" ,
16
14
"lint" : " eslint ." ,
Original file line number Diff line number Diff line change 1
- import path from 'path' ;
2
1
import resolve from 'rollup-plugin-node-resolve' ;
3
2
import commonjs from 'rollup-plugin-commonjs' ;
4
3
import uglify from 'rollup-plugin-uglify' ;
5
4
6
- const production = process . env . RU_ENV === 'production' ;
7
- const polyfill = process . env . RU_TYPE === 'polyfill' ;
5
+ const production = process . env . NODE_ENV === 'production' ;
6
+ const config = { } ;
8
7
9
- module . exports = {
8
+ config . ponyfill = {
10
9
input : 'fetch-browser-polyfill.js' ,
11
10
output : {
12
- file : path . join ( 'dist' , ` fetch-browser${ polyfill ? '-polyfill' : '' } .js` ) ,
11
+ file : 'dist/ fetch-browser.js' ,
13
12
format : 'cjs' ,
14
13
strict : false
15
14
} ,
@@ -21,6 +20,28 @@ module.exports = {
21
20
production && uglify ( ) ,
22
21
] ,
23
22
context : 'this' ,
24
- banner : polyfill ? '' : 'var self = {};' ,
25
- footer : polyfill ? '' : 'module.exports = self;'
23
+ banner : 'var self = {};' ,
24
+ footer : 'module.exports = self;'
26
25
} ;
26
+
27
+ config . polyfill = {
28
+ input : 'fetch-browser-polyfill.js' ,
29
+ output : {
30
+ file : 'dist/fetch-browser-polyfill.js' ,
31
+ format : 'cjs' ,
32
+ strict : false
33
+ } ,
34
+ plugins : [
35
+ resolve ( {
36
+ browser : true
37
+ } ) ,
38
+ commonjs ( ) ,
39
+ production && uglify ( ) ,
40
+ ] ,
41
+ context : 'this'
42
+ } ;
43
+
44
+ module . exports = [
45
+ config . ponyfill ,
46
+ config . polyfill
47
+ ] ;
You can’t perform that action at this time.
0 commit comments