{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/guui/pulls/comments/172163169","pull_request_review_id":101130284,"id":172163169,"diff_hunk":"@@ -1,114 +1,50 @@\n // @flow\n-/* eslint-disable global-require,import/no-dynamic-require */\n-\n-const { log } = require('util');\n-const fs = require('fs');\n const path = require('path');\n+const webpack = require('webpack');\n const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');\n const chalk = require('chalk');\n \n-require('@babel/register')({\n-    only: [/__tools__\\/demo|src/],\n+const friendlyErrorsWebpackPlugin = new FriendlyErrorsWebpackPlugin({\n+    compilationSuccessInfo: {\n+        messages: [\n+            `DEV server running at ${chalk.blue.underline(\n+                'http://localhost:3000',\n+            )}`,\n+        ],\n+    },\n });\n \n module.exports = {\n     browser: {\n+        name: 'browser',\n         devtool: 'cheap-module-eval-source-map',\n         entry: {\n+            app: ['webpack-hot-middleware/client', './src/browser'],\n             demo: './__tools__/demo/demo.browser.js',\n             src: './__tools__/demo/src.browser.js',\n         },\n-        devServer: {\n+        output: {\n+            path: path.resolve(__dirname, '../../', 'dist'),\n             publicPath: '/assets/javascript/',\n-            port: 3000,\n-            overlay: true,\n-            quiet: true,\n-            before(app) {\n-                // always serve the current version\n-                Object.keys(require.cache).forEach(\n-                    key => delete require.cache[key],\n-                );\n-\n-                app.get('/demo/*', async (req, res) => {\n-                    const demo = require('../../__tools__/demo/demo.server')\n-                        .default;\n-                    try {\n-                        res.send(demo(req.params[0].split('/demo/')[0]));\n-                    } catch (e) {\n-                        log(e);\n-                    }\n-                });\n-\n-                app.get('/src/*', async (req, res) => {\n-                    const src = require('../../__tools__/demo/src.server')\n-                        .default;\n-                    try {\n-                        res.send(src(req.params[0]));\n-                    } catch (e) {\n-                        log(e);\n-                    }\n-                });\n-\n-                app.get('/pages/*', async (req, res) => {\n-                    const page = require('../../src/server').default;\n-                    const pageType = req.params[0].split('/pages/')[0];\n-                    const data = require(`../../.data/${pageType}`);\n-\n-                    try {\n-                        res.send(await page(data));\n-                    } catch (e) {\n-                        log(e);\n-                    }\n-                });\n-\n-                app.get('/', async (req, res) => {\n-                    try {\n-                        res.send(`\n-                        <html>\n-                        <h3>pages</h3>\n-                        <ul>\n-                        ${fs\n-                            .readdirSync(\n-                                path.resolve(__dirname, '../../src/pages'),\n-                            )\n-                            .map(page => {\n-                                const name = page.replace(/.js$/, '');\n-                                return `<li><a href=\"/pages/${name}\">${name}</a></li>`;\n-                            })\n-                            .join('')}\n-                        </ul>\n-                        <h3>components</h3>\n-                        <ul>\n-                        ${fs\n-                            .readdirSync(\n-                                path.resolve(__dirname, '../../src/components'),\n-                            )\n-                            .filter(page => page.endsWith('.demo.js'))\n-                            .map(page => {\n-                                const name = page.replace(/.demo.js$/, '');\n-                                return `<li><a href=\"/demo/components/${name}\">${name}</a></li>`;\n-                            })\n-                            .join('')}\n-                        </ul>\n-                        </html>\n-                        `);\n-                    } catch (e) {\n-                        log(e);\n-                    }\n-                });\n-            },\n         },\n         plugins: [\n-            new FriendlyErrorsWebpackPlugin({\n-                compilationSuccessInfo: {\n-                    messages: [\n-                        `DEV server running at ${chalk.blue.underline(\n-                            'http://localhost:3000',\n-                        )}`,\n-                    ],\n-                },\n-            }),\n+            new webpack.HotModuleReplacementPlugin(),\n+            new webpack.NamedModulesPlugin(),\n+            friendlyErrorsWebpackPlugin,\n         ],\n     },\n-    server: {},\n+    server: {\n+        name: 'server',\n+        target: 'node',\n+        entry: {\n+            app: './src/server',\n+            demo: './__tools__/demo/demo.browser.js',\n+            src: './__tools__/demo/src.browser.js',\n+        },\n+        output: {\n+            path: path.resolve(__dirname, '../../', 'dist'),\n+            libraryTarget: 'commonjs2',","path":"__config__/webpack/webpack.config.dev.js","position":140,"original_position":140,"commit_id":"dae49b2427fe2cba31677740fdb302b8f937a754","original_commit_id":"dae49b2427fe2cba31677740fdb302b8f937a754","user":{"login":"sndrs","id":867233,"avatar_url":"https://avatars3.githubusercontent.com/u/867233?v=4","gravatar_id":"","url":"https://api.github.com/users/sndrs","html_url":"https://github.com/sndrs","followers_url":"https://api.github.com/users/sndrs/followers","following_url":"https://api.github.com/users/sndrs/following{/other_user}","gists_url":"https://api.github.com/users/sndrs/gists{/gist_id}","starred_url":"https://api.github.com/users/sndrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sndrs/subscriptions","organizations_url":"https://api.github.com/users/sndrs/orgs","repos_url":"https://api.github.com/users/sndrs/repos","events_url":"https://api.github.com/users/sndrs/events{/privacy}","received_events_url":"https://api.github.com/users/sndrs/received_events","type":"User","site_admin":false},"body":"i think this need to be moved up for dev and prod envs?","created_at":"2018-03-05T11:51:53Z","updated_at":"2018-03-05T11:54:44Z","html_url":"https://github.com/guardian/guui/pull/40#discussion_r172163169","pull_request_url":"https://api.github.com/repos/guardian/guui/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/guardian/guui/pulls/comments/172163169"},"html":{"href":"https://github.com/guardian/guui/pull/40#discussion_r172163169"},"pull_request":{"href":"https://api.github.com/repos/guardian/guui/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/guui/pulls/40","id":172835553,"html_url":"https://github.com/guardian/guui/pull/40","diff_url":"https://github.com/guardian/guui/pull/40.diff","patch_url":"https://github.com/guardian/guui/pull/40.patch","issue_url":"https://api.github.com/repos/guardian/guui/issues/40","number":40,"state":"open","locked":false,"title":"Express Dev Serve","user":{"login":"GHaberis","id":1590704,"avatar_url":"https://avatars2.githubusercontent.com/u/1590704?v=4","gravatar_id":"","url":"https://api.github.com/users/GHaberis","html_url":"https://github.com/GHaberis","followers_url":"https://api.github.com/users/GHaberis/followers","following_url":"https://api.github.com/users/GHaberis/following{/other_user}","gists_url":"https://api.github.com/users/GHaberis/gists{/gist_id}","starred_url":"https://api.github.com/users/GHaberis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GHaberis/subscriptions","organizations_url":"https://api.github.com/users/GHaberis/orgs","repos_url":"https://api.github.com/users/GHaberis/repos","events_url":"https://api.github.com/users/GHaberis/events{/privacy}","received_events_url":"https://api.github.com/users/GHaberis/received_events","type":"User","site_admin":false},"body":"## What does this change?\r\n\r\nReplaces the webpack dev server with an `express` Dev Server used in conjunction with `webpack-hot-server-middleware` and `webpack-dev-middleware`.\r\n\r\n## Why?\r\n\r\n- hot module replacement for the client using `webpack-hot-middleware`\r\n-  ensure the server bundle used is the latest without requiring a restart using `webpack-hot-server-middleware`\r\n\r\n","created_at":"2018-03-05T11:02:34Z","updated_at":"2018-03-05T11:54:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eec0d80d68f73b4a57a9a6490d21098574889699","assignee":null,"assignees":[],"requested_reviewers":[{"login":"SiAdcock","id":5931528,"avatar_url":"https://avatars1.githubusercontent.com/u/5931528?v=4","gravatar_id":"","url":"https://api.github.com/users/SiAdcock","html_url":"https://github.com/SiAdcock","followers_url":"https://api.github.com/users/SiAdcock/followers","following_url":"https://api.github.com/users/SiAdcock/following{/other_user}","gists_url":"https://api.github.com/users/SiAdcock/gists{/gist_id}","starred_url":"https://api.github.com/users/SiAdcock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SiAdcock/subscriptions","organizations_url":"https://api.github.com/users/SiAdcock/orgs","repos_url":"https://api.github.com/users/SiAdcock/repos","events_url":"https://api.github.com/users/SiAdcock/events{/privacy}","received_events_url":"https://api.github.com/users/SiAdcock/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/guardian/guui/pulls/40/commits","review_comments_url":"https://api.github.com/repos/guardian/guui/pulls/40/comments","review_comment_url":"https://api.github.com/repos/guardian/guui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/guui/issues/40/comments","statuses_url":"https://api.github.com/repos/guardian/guui/statuses/dae49b2427fe2cba31677740fdb302b8f937a754","head":{"label":"guardian:gh-express-dev-server","ref":"gh-express-dev-server","sha":"dae49b2427fe2cba31677740fdb302b8f937a754","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":107111499,"name":"guui","full_name":"guardian/guui","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/guui","description":"Frontend rendering tier","fork":false,"url":"https://api.github.com/repos/guardian/guui","forks_url":"https://api.github.com/repos/guardian/guui/forks","keys_url":"https://api.github.com/repos/guardian/guui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/guui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/guui/teams","hooks_url":"https://api.github.com/repos/guardian/guui/hooks","issue_events_url":"https://api.github.com/repos/guardian/guui/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/guui/events","assignees_url":"https://api.github.com/repos/guardian/guui/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/guui/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/guui/tags","blobs_url":"https://api.github.com/repos/guardian/guui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/guui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/guui/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/guui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/guui/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/guui/languages","stargazers_url":"https://api.github.com/repos/guardian/guui/stargazers","contributors_url":"https://api.github.com/repos/guardian/guui/contributors","subscribers_url":"https://api.github.com/repos/guardian/guui/subscribers","subscription_url":"https://api.github.com/repos/guardian/guui/subscription","commits_url":"https://api.github.com/repos/guardian/guui/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/guui/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/guui/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/guui/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/guui/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/guui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/guui/merges","archive_url":"https://api.github.com/repos/guardian/guui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/guui/downloads","issues_url":"https://api.github.com/repos/guardian/guui/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/guui/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/guui/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/guui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/guui/labels{/name}","releases_url":"https://api.github.com/repos/guardian/guui/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/guui/deployments","created_at":"2017-10-16T10:13:32Z","updated_at":"2018-02-08T11:42:21Z","pushed_at":"2018-03-05T11:43:19Z","git_url":"git://github.com/guardian/guui.git","ssh_url":"git@github.com:guardian/guui.git","clone_url":"https://github.com/guardian/guui.git","svn_url":"https://github.com/guardian/guui","homepage":"","size":533,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"e4c29a1440edba43e567079238b0657052b0642d","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":107111499,"name":"guui","full_name":"guardian/guui","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/guui","description":"Frontend rendering tier","fork":false,"url":"https://api.github.com/repos/guardian/guui","forks_url":"https://api.github.com/repos/guardian/guui/forks","keys_url":"https://api.github.com/repos/guardian/guui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/guui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/guui/teams","hooks_url":"https://api.github.com/repos/guardian/guui/hooks","issue_events_url":"https://api.github.com/repos/guardian/guui/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/guui/events","assignees_url":"https://api.github.com/repos/guardian/guui/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/guui/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/guui/tags","blobs_url":"https://api.github.com/repos/guardian/guui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/guui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/guui/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/guui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/guui/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/guui/languages","stargazers_url":"https://api.github.com/repos/guardian/guui/stargazers","contributors_url":"https://api.github.com/repos/guardian/guui/contributors","subscribers_url":"https://api.github.com/repos/guardian/guui/subscribers","subscription_url":"https://api.github.com/repos/guardian/guui/subscription","commits_url":"https://api.github.com/repos/guardian/guui/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/guui/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/guui/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/guui/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/guui/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/guui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/guui/merges","archive_url":"https://api.github.com/repos/guardian/guui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/guui/downloads","issues_url":"https://api.github.com/repos/guardian/guui/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/guui/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/guui/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/guui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/guui/labels{/name}","releases_url":"https://api.github.com/repos/guardian/guui/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/guui/deployments","created_at":"2017-10-16T10:13:32Z","updated_at":"2018-02-08T11:42:21Z","pushed_at":"2018-03-05T11:43:19Z","git_url":"git://github.com/guardian/guui.git","ssh_url":"git@github.com:guardian/guui.git","clone_url":"https://github.com/guardian/guui.git","svn_url":"https://github.com/guardian/guui","homepage":"","size":533,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/guui/pulls/40"},"html":{"href":"https://github.com/guardian/guui/pull/40"},"issue":{"href":"https://api.github.com/repos/guardian/guui/issues/40"},"comments":{"href":"https://api.github.com/repos/guardian/guui/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/guui/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/guui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/guui/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/guui/statuses/dae49b2427fe2cba31677740fdb302b8f937a754"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sndrs"}}