File tree 6 files changed +99
-0
lines changed
examples/babel-dynamically-entries
6 files changed +99
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "key3" : " value3" ,
3
+ "key2" : " value2" ,
4
+ "key1" : " value1"
5
+ }
Original file line number Diff line number Diff line change
1
+ if ( ! global . _babelPolyfill ) {
2
+ require ( 'babel-polyfill' ) ;
3
+ }
4
+
5
+ export const hello = ( event , context , cb ) => {
6
+ const p = new Promise ( ( resolve , reject ) => {
7
+ resolve ( 'success' ) ;
8
+ } ) ;
9
+ p
10
+ . then ( r => cb ( null , {
11
+ message : 'Go Serverless Webpack (Babel) v1.0! First module!' ,
12
+ event,
13
+ } ) )
14
+ . catch ( e => cb ( e ) ) ;
15
+ } ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " serverless-webpack-babel-example" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " Serverless webpack example using Babel" ,
5
+ "scripts" : {
6
+ "test" : " echo \" Error: no test specified\" && exit 1"
7
+ },
8
+ "author" : " Nicola Peduzzi <thenikso@gmail.com> (http://nikso.net)" ,
9
+ "license" : " MIT" ,
10
+ "devDependencies" : {
11
+ "babel-core" : " ^6.24.1" ,
12
+ "babel-loader" : " ^7.1.1" ,
13
+ "babel-plugin-transform-runtime" : " ^6.23.0" ,
14
+ "babel-polyfill" : " 6.13.0" ,
15
+ "babel-preset-env" : " ^1.6.0" ,
16
+ "serverless-webpack" : " file:../../" ,
17
+ "webpack" : " ^1.13.1"
18
+ }
19
+ }
Original file line number Diff line number Diff line change
1
+ if ( ! global . _babelPolyfill ) {
2
+ require ( 'babel-polyfill' ) ;
3
+ }
4
+
5
+ export const hello = ( event , context , cb ) => {
6
+ const p = new Promise ( ( resolve , reject ) => {
7
+ resolve ( 'success' ) ;
8
+ } ) ;
9
+ p
10
+ . then ( r => cb ( null , {
11
+ message : 'Go Serverless Webpack (Babel) v1.0! Second module!' ,
12
+ event,
13
+ } ) )
14
+ . catch ( e => cb ( e ) ) ;
15
+ } ;
Original file line number Diff line number Diff line change
1
+ service : babel-dynamically-entries-example
2
+
3
+ # Add the serverless-webpack plugin
4
+ plugins :
5
+ - serverless-webpack
6
+
7
+ provider :
8
+ name : aws
9
+ runtime : nodejs4.3
10
+
11
+ functions :
12
+ first :
13
+ handler : first.hello
14
+ events :
15
+ - http :
16
+ method : get
17
+ path : first
18
+ integration : lambda
19
+ second :
20
+ handler : second.hello
21
+ events :
22
+ - http :
23
+ method : get
24
+ path : second
25
+ integration : lambda
Original file line number Diff line number Diff line change
1
+ const path = require ( 'path' ) ;
2
+ const slsw = require ( 'serverless-webpack' ) ;
3
+
4
+ module . exports = {
5
+ entry : slsw . lib . entries ,
6
+ target : 'node' ,
7
+ module : {
8
+ loaders : [ {
9
+ test : / \. j s $ / ,
10
+ loaders : [ 'babel-loader' ] ,
11
+ include : __dirname ,
12
+ exclude : / n o d e _ m o d u l e s / ,
13
+ } ]
14
+ } ,
15
+ output : {
16
+ libraryTarget : 'commonjs' ,
17
+ path : path . join ( __dirname , '.webpack' ) ,
18
+ filename : '[name].js'
19
+ }
20
+ } ;
You can’t perform that action at this time.
0 commit comments