This repository was archived by the owner on Jan 5, 2023. It is now read-only.
File tree 3 files changed +73
-0
lines changed
3 files changed +73
-0
lines changed Original file line number Diff line number Diff line change 4
4
"description" : " itaigi" ,
5
5
"scripts" : {
6
6
"start" : " node devServer.js" ,
7
+ "production" : " NODE_ENV=production webpack -p --progress --config webpack.config.js && node prerender" ,
8
+ "server" : " node prerender" ,
7
9
"test" : " jscs *.js src/" ,
8
10
"reformat" : " jscs -x *.js src/" ,
9
11
"build" : " mkdir -p build;rm -f build/* && NODE_ENV=production webpack --config webpack.config.prod.js && cp index.html favicons/* build/ && cp index.html build/404.html" ,
Original file line number Diff line number Diff line change
1
+ var express = require ( "express" ) ;
2
+ var path = require ( "path" ) ;
3
+ var page = require ( "./bundle.js" ) ;
4
+
5
+ var app = express ( ) ;
6
+
7
+ app . use ( express . static ( path . join ( __dirname , ".." , "build" ) ) ) ;
8
+
9
+ var stats = require ( "./stats.generated.json" ) ;
10
+
11
+ app . get ( "/" , function ( req , res ) {
12
+ res . end ( page ( req , stats . assetsByChunkName . main ) ) ;
13
+ } ) ;
14
+
15
+ var server = app . listen ( 3000 , function ( ) {
16
+ console . log ( 'Listening on port %d' , server . address ( ) . port ) ;
17
+ } ) ;
Original file line number Diff line number Diff line change
1
+ var path = require ( 'path' ) ;
2
+ var webpack = require ( 'webpack' ) ;
3
+
4
+ module . exports = {
5
+ devtool : 'source-map' ,
6
+ entry : [
7
+ './src' ,
8
+ ] ,
9
+
10
+ target : "node" ,
11
+ output : {
12
+ path : path . join ( __dirname , 'prerender' ) ,
13
+ filename : 'bundle.js' ,
14
+ publicPath : '/' ,
15
+ } ,
16
+ plugins : [
17
+ new webpack . optimize . OccurenceOrderPlugin ( ) ,
18
+ new webpack . DefinePlugin ( {
19
+ 'process.env' : {
20
+ NODE_ENV : JSON . stringify ( 'production' ) ,
21
+ } ,
22
+ "global.GENTLY" : false
23
+ } ) ,
24
+ new webpack . optimize . UglifyJsPlugin ( {
25
+ compressor : {
26
+ warnings : false ,
27
+ } ,
28
+ } ) ,
29
+ ] ,
30
+ resolve : {
31
+ extensions : [ '' , '.js' , '.jsx' ] ,
32
+ } ,
33
+ module : {
34
+ loaders : [
35
+ {
36
+ test : / \. j s x ? / ,
37
+ loaders : [ 'babel' , 'strict' ] ,
38
+ include : path . join ( __dirname , 'src' ) ,
39
+ } ,
40
+ {
41
+ test : / \. c s s $ / ,
42
+ loader : 'style-loader!css-loader!postcss-loader' ,
43
+ } ,
44
+ {
45
+ test : / \. ( p n g | j p g | g i f | s v g ) $ / ,
46
+ loader : 'url-loader?limit=1' ,
47
+ } ,
48
+ {
49
+ test : / \. j s o n $ / ,
50
+ loader : 'json-loader' ,
51
+ } ,
52
+ ] ,
53
+ } ,
54
+ } ;
You can’t perform that action at this time.
0 commit comments