-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
40 lines (34 loc) · 1.33 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"use strict";
global.navigator = {userAgent: "all"};
process.on("SIGINT", () => {
process.exit(0);
});
const config = require("electrode-confippet").config;
const staticPathsDecor = require("electrode-static-paths");
const supports = require("electrode-archetype-react-app/supports");
/**
* Use babel register to transpile any JSX code on the fly to run
* in server mode, and also transpile react code to apply process.env.NODE_ENV
* removal to improve performance in production mode.
*/
supports.babelRegister({
ignore: /node_modules\/(?!react\/)/
});
/**
* css-modules-require-hook: handle css-modules on node.js server.
* similar to Babel's babel/register it compiles CSS modules in runtime.
*
* generateScopedName - Short alias for the postcss-modules-scope plugin's option.
* Helps you to specify the custom way to build generic names for the class selectors.
* You may also use a string pattern similar to the webpack's css-loader.
*
* https://github.com/css-modules/css-modules-require-hook#generatescopedname-function
* https://github.com/webpack/css-loader#local-scope
* https://github.com/css-modules/postcss-modules-scope
*/
supports.cssModuleHook({
generateScopedName: "[name]__[local]___[hash:base64:5]"
});
supports.isomorphicExtendRequire().then(() => {
require("electrode-server")(config, [staticPathsDecor()]);
});