Commit 9a25a8ca authored by jnsone11's avatar jnsone11
Browse files

add ssr

parent 54bab7b0
......@@ -5,9 +5,9 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build" : "docker build -t workshop/graphqlapi .",
"build" : "docker build --no-cache -t workshop/graphqlapi .",
"showImages" : "docker images",
"start" : "node_modules/.bin/postgraphile -c postgresql://postgres@backend-database-postgresql/postgres -s workshop -w"
"start" : "node_modules/.bin/postgraphile -o -c postgresql://postgres@backend-database-postgresql/postgres -s workshop -w"
},
"author": "Jens Neuse <jens.neuse@gmx.de>",
"license": "ISC",
......
webpackJsonp([0],{16:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const l=n(0),o=n(18),r=n(28);o.hydrate(l.createElement(()=>l.createElement(r.default,null),null),document.getElementById("react-root"))},28:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const l=n(0),o=n(0);t.default=class extends o.Component{render(){return l.createElement("div",null,"Hello World !!!")}}},5:function(e,t,n){n(6),e.exports=n(16)}},[5]);
\ No newline at end of file
webpackJsonp([0],{240:function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=l(0),r=l(0),a=l(24);t.default=class extends r.Component{render(){return n.createElement("div",null,n.createElement("h1",null,"Header"),n.createElement("ul",null,n.createElement("li",null,n.createElement(a.Link,{to:"/"},"Main")),n.createElement("li",null,n.createElement(a.Link,{to:"/authors"},"Authors")),n.createElement("li",null,n.createElement(a.Link,{to:"/articles"},"Articles"))))}}},241:function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=l(0),r=l(0);t.default=class extends r.Component{render(){return n.createElement("div",null,n.createElement("p",null,"Main"))}}},242:function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=l(0),r=l(0),a=l(77),o=l(31),u=a.default`
query getAllAuthors {
allAuthors {
totalCount
nodes {
nodeId
id
name
bornIn
articlesByAuthorId {
totalCount
}
}
}
}
`;t.default=class extends r.Component{render(){return n.createElement("div",null,n.createElement("p",null,"Authors"),n.createElement(o.Query,{query:u},e=>e.loading?n.createElement("p",null,"Loading..."):e.error?n.createElement("p",null,e.error.message):n.createElement("ol",null,e.data.allAuthors.nodes.map(e=>n.createElement("li",null,n.createElement("h3",null,e.name),n.createElement("h4",null,e.bornIn),n.createElement("p",null,"Total Articles Count: ",e.articlesByAuthorId.totalCount))))))}}},252:function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=l(0),r=l(0),a=l(77),o=l(31),u=a.default`
query getAllArticles {
allArticles {
totalCount
nodes {
nodeId
id
title
description
content
authorId
authorByAuthorId {
id
}
}
}
}
`;t.default=class extends r.Component{render(){return n.createElement("div",null,n.createElement(o.Query,{query:u},e=>e.loading?n.createElement("div",null,"Loading..."):e.error?n.createElement("div",null,"Error: ",e.error.message):n.createElement("div",null,n.createElement("p",null,"Articles"),n.createElement("ol",null,e.data.allArticles.nodes.map(e=>n.createElement("li",{key:e.nodeId},n.createElement("h3",null,e.title),e.description&&n.createElement("p",null,e.description)||n.createElement("p",null,"No description available")))))))}}},45:function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=l(0),r=l(0),a=l(24),o=l(240),u=l(241),c=l(242),d=l(252);t.default=class extends r.Component{render(){return n.createElement("div",null,n.createElement(o.default,null),n.createElement(a.Route,{exact:!0,path:"/",component:u.default}),n.createElement(a.Route,{exact:!0,path:"/authors",component:c.default}),n.createElement(a.Route,{exact:!0,path:"/articles",component:d.default}))}}},82:function(e,t,l){l(83),e.exports=l(92)},92:function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=l(0),r=l(94),a=l(24),o=l(31),u=l(200),c=l(218),d=l(231),s=new c.default({link:new u.default({uri:"/graphql"}),cache:(new d.InMemoryCache).restore(window.__APOLLO_STATE__)}),i=l(45),m=document.getElementById("react-root"),E=e=>n.createElement(o.ApolloProvider,{client:s},n.createElement(a.BrowserRouter,null,n.createElement(e,null)));e.hot.accept(45,()=>{Promise.resolve().then(()=>l(45)).then(e=>{r.hydrate(E(e.default),m)})}),r.hydrate(E(i.default),m)}},[82]);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -60,7 +60,7 @@
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 2);
/******/ return __webpack_require__(__webpack_require__.s = 5);
/******/ })
/************************************************************************/
/******/ ([
......@@ -73,33 +73,64 @@ module.exports = require("react");
/* 1 */
/***/ (function(module, exports) {
module.exports = require("webpack");
module.exports = require("react-apollo");
/***/ }),
/* 2 */
/***/ (function(module, exports) {
module.exports = require("react-router-dom");
/***/ }),
/* 3 */
/***/ (function(module, exports) {
module.exports = require("graphql-tag");
/***/ }),
/* 4 */
/***/ (function(module, exports) {
module.exports = require("webpack");
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(6);
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express = __webpack_require__(3);
const serverRender_1 = __webpack_require__(4);
const express = __webpack_require__(7);
const postgraphile_1 = __webpack_require__(8);
const serverRender_1 = __webpack_require__(9);
const IS_PRODUCTION = process.env.NODE_ENV === 'production';
const PORT = parseInt(process.env.PORT) || 8080;
const HOST = 'localhost';
const server = express();
server.use(postgraphile_1.postgraphile('postgres://postgres@localhost:15432/postgres', 'workshop', {
graphiql: true,
graphqlRoute: '/graphql'
}));
if (!IS_PRODUCTION) {
const webpackDevMiddleware = __webpack_require__(6);
const webpack = __webpack_require__(1);
const webpackConfig = __webpack_require__(7);
const webpackDevMiddleware = __webpack_require__(19);
const webpack = __webpack_require__(4);
const webpackConfig = __webpack_require__(20);
const compiler = webpack(webpackConfig);
server.use(webpackDevMiddleware(compiler, {
publicPath: "/",
noInfo: true
}));
server.use(__webpack_require__(13)(compiler));
server.use(__webpack_require__(26)(compiler));
}
server.get('*', (req, res) => {
const context = {};
serverRender_1.default(req.url).then((html) => {
res.status(200);
res.end(html);
......@@ -117,37 +148,64 @@ server.listen(PORT, HOST, () => {
;(function register() { /* react-hot-loader/webpack */ if (process.env.NODE_ENV !== 'production') { if (typeof __REACT_HOT_LOADER__ === 'undefined') { return; } /* eslint-disable camelcase, no-undef */ var webpackExports = typeof __webpack_exports__ !== 'undefined' ? __webpack_exports__ : module.exports; /* eslint-enable camelcase, no-undef */ if (typeof webpackExports === 'function') { __REACT_HOT_LOADER__.register(webpackExports, 'module.exports', "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/server/server.tsx"); return; } /* eslint-disable no-restricted-syntax */ for (var key in webpackExports) { /* eslint-enable no-restricted-syntax */ if (!Object.prototype.hasOwnProperty.call(webpackExports, key)) { continue; } var namedExport = void 0; try { namedExport = webpackExports[key]; } catch (err) { continue; } __REACT_HOT_LOADER__.register(namedExport, key, "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/server/server.tsx"); } } })();
/***/ }),
/* 3 */
/* 7 */
/***/ (function(module, exports) {
module.exports = require("express");
/***/ }),
/* 4 */
/* 8 */
/***/ (function(module, exports) {
module.exports = require("postgraphile");
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = __webpack_require__(0);
//import {renderToString} from "react-dom/server"
const routes_1 = __webpack_require__(5);
const routes_1 = __webpack_require__(10);
const apollo_client_1 = __webpack_require__(15);
const react_apollo_1 = __webpack_require__(1);
const apollo_link_http_1 = __webpack_require__(16);
const react_router_1 = __webpack_require__(17);
const apollo_cache_inmemory_1 = __webpack_require__(18);
function default_1(url) {
const App = (React.createElement("div", null,
React.createElement(routes_1.default, null)));
//const applicationHTML = renderToString(App);
const link = new apollo_link_http_1.default({
uri: 'http://localhost:8080/graphql'
});
const client = new apollo_client_1.default({
ssrMode: true,
link,
cache: new apollo_cache_inmemory_1.InMemoryCache()
});
const context = {};
const App = (React.createElement(react_apollo_1.ApolloProvider, { client: client },
React.createElement(react_router_1.StaticRouter, { location: url, context: context },
React.createElement(routes_1.default, null))));
console.log(context);
return new Promise((resolve, reject) => {
resolve(`<!DOCTYPE html>
<html>
<head>
<link rel="apple-touch-icon" sizes="57x57" href="/icon.png" />
</head>
<body>
<div id="react-root"></div>
<script type="text/javascript" src="/vendor.js"></script>
<script type="text/javascript" src="/client.js"></script>
</body>
</html>`);
react_apollo_1.renderToStringWithData(App)
.then((reactHtmlContent) => {
const initialState = JSON.stringify(client.extract()).replace(/</g, '\\u003c');
resolve(`<!DOCTYPE html>
<html>
<head>
<link rel="apple-touch-icon" sizes="57x57" href="/icon.png" />
</head>
<body>
<div id="react-root">${reactHtmlContent}</div>
<script>window.__APOLLO_STATE__=${initialState}</script>
<script type="text/javascript" src="/vendor.js"></script>
<script type="text/javascript" src="/client.js"></script>
</body>
</html>`);
}).catch((reason) => {
reject(reason);
});
});
}
exports.default = default_1;
......@@ -156,7 +214,7 @@ exports.default = default_1;
;(function register() { /* react-hot-loader/webpack */ if (process.env.NODE_ENV !== 'production') { if (typeof __REACT_HOT_LOADER__ === 'undefined') { return; } /* eslint-disable camelcase, no-undef */ var webpackExports = typeof __webpack_exports__ !== 'undefined' ? __webpack_exports__ : module.exports; /* eslint-enable camelcase, no-undef */ if (typeof webpackExports === 'function') { __REACT_HOT_LOADER__.register(webpackExports, 'module.exports', "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/server/serverRender.tsx"); return; } /* eslint-disable no-restricted-syntax */ for (var key in webpackExports) { /* eslint-enable no-restricted-syntax */ if (!Object.prototype.hasOwnProperty.call(webpackExports, key)) { continue; } var namedExport = void 0; try { namedExport = webpackExports[key]; } catch (err) { continue; } __REACT_HOT_LOADER__.register(namedExport, key, "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/server/serverRender.tsx"); } } })();
/***/ }),
/* 5 */
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -164,9 +222,18 @@ exports.default = default_1;
Object.defineProperty(exports, "__esModule", { value: true });
const React = __webpack_require__(0);
const react_1 = __webpack_require__(0);
const react_router_dom_1 = __webpack_require__(2);
const header_1 = __webpack_require__(11);
const home_1 = __webpack_require__(12);
const allAuthors_1 = __webpack_require__(13);
const allArticles_1 = __webpack_require__(14);
class Routes extends react_1.Component {
render() {
return (React.createElement("div", null, "Hello World !!!"));
return React.createElement("div", null,
React.createElement(header_1.default, null),
React.createElement(react_router_dom_1.Route, { exact: true, path: "/", component: home_1.default }),
React.createElement(react_router_dom_1.Route, { exact: true, path: "/authors", component: allAuthors_1.default }),
React.createElement(react_router_dom_1.Route, { exact: true, path: "/articles", component: allArticles_1.default }));
}
}
exports.default = Routes;
......@@ -175,47 +242,200 @@ exports.default = Routes;
;(function register() { /* react-hot-loader/webpack */ if (process.env.NODE_ENV !== 'production') { if (typeof __REACT_HOT_LOADER__ === 'undefined') { return; } /* eslint-disable camelcase, no-undef */ var webpackExports = typeof __webpack_exports__ !== 'undefined' ? __webpack_exports__ : module.exports; /* eslint-enable camelcase, no-undef */ if (typeof webpackExports === 'function') { __REACT_HOT_LOADER__.register(webpackExports, 'module.exports', "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/routes.tsx"); return; } /* eslint-disable no-restricted-syntax */ for (var key in webpackExports) { /* eslint-enable no-restricted-syntax */ if (!Object.prototype.hasOwnProperty.call(webpackExports, key)) { continue; } var namedExport = void 0; try { namedExport = webpackExports[key]; } catch (err) { continue; } __REACT_HOT_LOADER__.register(namedExport, key, "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/routes.tsx"); } } })();
/***/ }),
/* 6 */
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = __webpack_require__(0);
const react_1 = __webpack_require__(0);
const react_router_dom_1 = __webpack_require__(2);
class Header extends react_1.Component {
render() {
return (React.createElement("div", null,
React.createElement("h1", null, "Header"),
React.createElement("ul", null,
React.createElement("li", null,
React.createElement(react_router_dom_1.Link, { to: "/" }, "Main")),
React.createElement("li", null,
React.createElement(react_router_dom_1.Link, { to: "/authors" }, "Authors")),
React.createElement("li", null,
React.createElement(react_router_dom_1.Link, { to: "/articles" }, "Articles")))));
}
}
exports.default = Header;
;(function register() { /* react-hot-loader/webpack */ if (process.env.NODE_ENV !== 'production') { if (typeof __REACT_HOT_LOADER__ === 'undefined') { return; } /* eslint-disable camelcase, no-undef */ var webpackExports = typeof __webpack_exports__ !== 'undefined' ? __webpack_exports__ : module.exports; /* eslint-enable camelcase, no-undef */ if (typeof webpackExports === 'function') { __REACT_HOT_LOADER__.register(webpackExports, 'module.exports', "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/components/header.tsx"); return; } /* eslint-disable no-restricted-syntax */ for (var key in webpackExports) { /* eslint-enable no-restricted-syntax */ if (!Object.prototype.hasOwnProperty.call(webpackExports, key)) { continue; } var namedExport = void 0; try { namedExport = webpackExports[key]; } catch (err) { continue; } __REACT_HOT_LOADER__.register(namedExport, key, "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/components/header.tsx"); } } })();
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = __webpack_require__(0);
const react_1 = __webpack_require__(0);
class Home extends react_1.Component {
render() {
return (React.createElement("div", null,
React.createElement("p", null, "Main")));
}
}
exports.default = Home;
;(function register() { /* react-hot-loader/webpack */ if (process.env.NODE_ENV !== 'production') { if (typeof __REACT_HOT_LOADER__ === 'undefined') { return; } /* eslint-disable camelcase, no-undef */ var webpackExports = typeof __webpack_exports__ !== 'undefined' ? __webpack_exports__ : module.exports; /* eslint-enable camelcase, no-undef */ if (typeof webpackExports === 'function') { __REACT_HOT_LOADER__.register(webpackExports, 'module.exports', "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/components/home.tsx"); return; } /* eslint-disable no-restricted-syntax */ for (var key in webpackExports) { /* eslint-enable no-restricted-syntax */ if (!Object.prototype.hasOwnProperty.call(webpackExports, key)) { continue; } var namedExport = void 0; try { namedExport = webpackExports[key]; } catch (err) { continue; } __REACT_HOT_LOADER__.register(namedExport, key, "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/components/home.tsx"); } } })();
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = __webpack_require__(0);
const graphql_tag_1 = __webpack_require__(3);
const react_apollo_1 = __webpack_require__(1);
const query = graphql_tag_1.default `
query getAllAuthors {
allAuthors {
totalCount
nodes {
nodeId
id
name
bornIn
articlesByAuthorId {
totalCount
}
}
}
}
`;
class AllAuthors extends React.Component {
render() {
return (React.createElement("div", null,
React.createElement("p", null, JSON.stringify(this.props))));
}
}
exports.default = react_apollo_1.graphql(query)(AllAuthors);
;(function register() { /* react-hot-loader/webpack */ if (process.env.NODE_ENV !== 'production') { if (typeof __REACT_HOT_LOADER__ === 'undefined') { return; } /* eslint-disable camelcase, no-undef */ var webpackExports = typeof __webpack_exports__ !== 'undefined' ? __webpack_exports__ : module.exports; /* eslint-enable camelcase, no-undef */ if (typeof webpackExports === 'function') { __REACT_HOT_LOADER__.register(webpackExports, 'module.exports', "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/components/allAuthors.tsx"); return; } /* eslint-disable no-restricted-syntax */ for (var key in webpackExports) { /* eslint-enable no-restricted-syntax */ if (!Object.prototype.hasOwnProperty.call(webpackExports, key)) { continue; } var namedExport = void 0; try { namedExport = webpackExports[key]; } catch (err) { continue; } __REACT_HOT_LOADER__.register(namedExport, key, "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/components/allAuthors.tsx"); } } })();
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = __webpack_require__(0);
const react_1 = __webpack_require__(0);
const graphql_tag_1 = __webpack_require__(3);
const react_apollo_1 = __webpack_require__(1);
const query = graphql_tag_1.default `
query getAllArticles {
allArticles {
totalCount
nodes {
nodeId
id
title
description
content
authorId
authorByAuthorId {
id
}
}
}
}
`;
class AllArticles extends react_1.Component {
render() {
return (React.createElement("div", null, JSON.stringify(this.props)));
}
}
exports.default = react_apollo_1.graphql(query)(AllArticles);
;(function register() { /* react-hot-loader/webpack */ if (process.env.NODE_ENV !== 'production') { if (typeof __REACT_HOT_LOADER__ === 'undefined') { return; } /* eslint-disable camelcase, no-undef */ var webpackExports = typeof __webpack_exports__ !== 'undefined' ? __webpack_exports__ : module.exports; /* eslint-enable camelcase, no-undef */ if (typeof webpackExports === 'function') { __REACT_HOT_LOADER__.register(webpackExports, 'module.exports', "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/components/allArticles.tsx"); return; } /* eslint-disable no-restricted-syntax */ for (var key in webpackExports) { /* eslint-enable no-restricted-syntax */ if (!Object.prototype.hasOwnProperty.call(webpackExports, key)) { continue; } var namedExport = void 0; try { namedExport = webpackExports[key]; } catch (err) { continue; } __REACT_HOT_LOADER__.register(namedExport, key, "/Users/jnsone11/repos/react-workshop/front-end/renderine/src/common/components/allArticles.tsx"); } } })();
/***/ }),
/* 15 */
/***/ (function(module, exports) {
module.exports = require("apollo-client");
/***/ }),
/* 16 */
/***/ (function(module, exports) {
module.exports = require("apollo-link-http");
/***/ }),
/* 17 */
/***/ (function(module, exports) {
module.exports = require("react-router");
/***/ }),
/* 18 */
/***/ (function(module, exports) {
module.exports = require("apollo-cache-inmemory");
/***/ }),
/* 19 */
/***/ (function(module, exports) {
module.exports = require("webpack-dev-middleware");
/***/ }),
/* 7 */
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(__dirname) {const path = __webpack_require__(8);
const webpack = __webpack_require__(1);
/* WEBPACK VAR INJECTION */(function(__dirname) {const path = __webpack_require__(21);
const webpack = __webpack_require__(4);
const UglifyJSPlugin = __webpack_require__(9);
const ExtractTextPlugin = __webpack_require__(10);
const StatsWriterPlugin = __webpack_require__(11).StatsWriterPlugin;
const BundleAnalyzerPlugin = __webpack_require__(12).BundleAnalyzerPlugin;
const UglifyJSPlugin = __webpack_require__(22);
const ExtractTextPlugin = __webpack_require__(23);
const StatsWriterPlugin = __webpack_require__(24).StatsWriterPlugin;
const BundleAnalyzerPlugin = __webpack_require__(25).BundleAnalyzerPlugin;
const IS_PRODUCTION = process.env.NODE_ENV === 'production';
console.log('IS_PRODUCTION: ',IS_PRODUCTION);
console.log('IS_PRODUCTION: ', IS_PRODUCTION);
let plugins = [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.js',
minChunks: function (module, count) {
return module.context && module.context.indexOf("node_modules") !== -1;
}
}),
new webpack
.optimize
.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.js',
minChunks: function (module, count) {
return module.context && module
.context
.indexOf("node_modules") !== -1;
}
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production'),
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack
.optimize
.AggressiveMergingPlugin(),
new webpack
.optimize
.OccurrenceOrderPlugin(),
new UglifyJSPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new webpack.LoaderOptionsPlugin({minimize: true, debug: false}),
/*new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
......@@ -226,36 +446,32 @@ let plugins = [
];
if (IS_PRODUCTION) {
plugins.push(new BundleAnalyzerPlugin({
analyzerMode: 'static'
}));
plugins.push(new BundleAnalyzerPlugin({analyzerMode: 'static'}));
} else {
plugins.push(new webpack.HotModuleReplacementPlugin());
plugins.push(new webpack.NoEmitOnErrorsPlugin());
}
const loaders = IS_PRODUCTION ?
[
const loaders = IS_PRODUCTION
? [
{
loader: 'awesome-typescript-loader'
}
] :
[
]
: [
{
loader: 'react-hot-loader/webpack'
},
{
}, {
loader: 'awesome-typescript-loader'
}
];
module.exports = {
entry: IS_PRODUCTION ? [
'./src/client/client.tsx'
] : [
'webpack-hot-middleware/client',
'./src/client/client.tsx'
],
entry: IS_PRODUCTION
? ['./src/client/client.tsx']
: [
'webpack-hot-middleware/client', './src/client/client.tsx'
],
output: {
filename: 'client.js',
path: path.resolve(__dirname, 'dist/client'),
......@@ -274,52 +490,59 @@ module.exports = {
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
// All files with a '.ts' or '.tsx' extension will be handled by
// 'awesome-typescript-loader'.
{
test: /\.tsx?$/,
exclude: /(node_modules|bower_components)/,
use: loaders
},
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{enforce: "pre", test: /\.js$/, loader: "source-map-loader"}
// All output '.js' files will have any sourcemaps re-processed by
// 'source-map-loader'.
{
enforce: 'pre',
test: /\.js$/,
loader: "source-map-loader",
exclude: [/node_modules/, /build/, /__test__/]
}
]
}
};
/* WEBPACK VAR INJECTION */}.call(exports, "/"))
/***/ }),
/* 8 */
/* 21 */
/***/ (function(module, exports) {
module.exports = require("path");
/***/ }),
/* 9 */
/* 22 */
/***/ (function(module, exports) {
module.exports = require("uglifyjs-webpack-plugin");
/***/ }),
/* 10 */
/* 23 */
/***/ (function(module, exports) {