{"action":"created","issue":{"url":"https://api.github.com/repos/glenjamin/webpack-hot-middleware/issues/116","repository_url":"https://api.github.com/repos/glenjamin/webpack-hot-middleware","labels_url":"https://api.github.com/repos/glenjamin/webpack-hot-middleware/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/glenjamin/webpack-hot-middleware/issues/116/comments","events_url":"https://api.github.com/repos/glenjamin/webpack-hot-middleware/issues/116/events","html_url":"https://github.com/glenjamin/webpack-hot-middleware/issues/116","id":163970150,"number":116,"title":"How can i use this plugin toghether with webpack-merge?","user":{"login":"pokakhoaitay","id":7122384,"avatar_url":"https://avatars.githubusercontent.com/u/7122384?v=3","gravatar_id":"","url":"https://api.github.com/users/pokakhoaitay","html_url":"https://github.com/pokakhoaitay","followers_url":"https://api.github.com/users/pokakhoaitay/followers","following_url":"https://api.github.com/users/pokakhoaitay/following{/other_user}","gists_url":"https://api.github.com/users/pokakhoaitay/gists{/gist_id}","starred_url":"https://api.github.com/users/pokakhoaitay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pokakhoaitay/subscriptions","organizations_url":"https://api.github.com/users/pokakhoaitay/orgs","repos_url":"https://api.github.com/users/pokakhoaitay/repos","events_url":"https://api.github.com/users/pokakhoaitay/events{/privacy}","received_events_url":"https://api.github.com/users/pokakhoaitay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-05T23:42:38Z","updated_at":"2016-07-06T08:14:14Z","closed_at":null,"body":"In my `webpack.config.js:` file, i was used webpack-merge like this: \r\n\r\n```javascript\r\n\r\nvar webpack = require('webpack');\r\nvar path = require('path');\r\n\r\nvar commonConfig = {\r\n    resolve : {\r\n        extensions : [ '', '.ts', '.js', '.json' ]\r\n    },\r\n    module : {\r\n        loaders : [\r\n            // TypeScript\r\n            { test : /\\.ts$/, loaders : [ 'ts-loader', 'angular2-template-loader' ] },\r\n            { test : /\\.html$/, loader : 'raw-loader' },\r\n            { test : /\\.css$/, loader : 'raw-loader' },\r\n            { test : /\\.json$/, loader : 'raw-loader' }\r\n        ],\r\n        preLoaders : [\r\n            // needed to lower the filesize of angular due to inline source-maps\r\n            { test : /\\.js$/, loader : 'source-map-loader' }\r\n        ],\r\n    },\r\n    plugins : [\r\n        new webpack.optimize.OccurenceOrderPlugin(true),\r\n        new webpack.HotModuleReplacementPlugin(),\r\n        new webpack.NoErrorsPlugin()\r\n    ]\r\n\r\n};\r\n\r\n\r\nvar clientConfig = {\r\n    target : 'web',\r\n    entry : ['./src/client'],\r\n    output : {\r\n        path : root('dist/client')\r\n    },\r\n    node : {\r\n        global : true,\r\n        __dirname : true,\r\n        __filename : true,\r\n        process : true,\r\n        Buffer : false\r\n    }\r\n};\r\n\r\n\r\nvar serverConfig = {\r\n    target : 'node',\r\n    entry : ['./src/server'], // use the entry file of the node server if everything is ts rather than es5\r\n    output : {\r\n        path : root('dist/server'),\r\n        libraryTarget : 'commonjs2'\r\n    },\r\n    externals : checkNodeImport,\r\n    node : {\r\n        global : true,\r\n        __dirname : true,\r\n        __filename : true,\r\n        process : true,\r\n        Buffer : true\r\n    }\r\n};\r\n\r\n\r\n// Default config\r\nvar defaultConfig = {\r\n    context : __dirname,\r\n    entry : ['webpack-hot-middleware/client'],\r\n    resolve : {\r\n        root : root('../src')\r\n    },\r\n    output : {\r\n        publicPath :path.resolve(__dirname),\r\n        filename : 'index.js'\r\n    }\r\n}\r\n\r\n\r\nvar webpackMerge = require('webpack-merge');\r\nmodule.exports = [\r\n    // Client\r\n    webpackMerge({}, defaultConfig, commonConfig, clientConfig),\r\n\r\n    // Server\r\n    webpackMerge({}, defaultConfig, commonConfig, serverConfig)\r\n]\r\n\r\n// Helpers\r\nfunction checkNodeImport( context, request, cb ) {\r\n    if ( !path.isAbsolute(request) && request.charAt(0) !== '.' ) {\r\n        cb(null, 'commonjs ' + request);\r\n        return;\r\n    }\r\n    cb();\r\n}\r\n\r\nfunction root( args ) {\r\n    args = Array.prototype.slice.call(arguments, 0);\r\n    return path.join.apply(path, [ __dirname ].concat(args));\r\n}\r\n\r\n```\r\n\r\nI tried do this in my `server.ts` file (i thought my problem was wrong config to working for webpack-merge):\r\n```typescript\r\nvar webpack = require('webpack');\r\n\r\nvar webpackConfig = require('../webpack.config')[1];\r\nvar compiler = webpack(webpackConfig);\r\n\r\napp.use(require(\"webpack-hot-middleware\")(compiler));\r\n```\r\nBut it was getting this error: \r\n```\r\nC:\\my-project\\node_modules\\webpack-hot-middleware\\client.js:12\r\nif (__resourceQuery) {\r\n    ^\r\n\r\nReferenceError: __resourceQuery is not defined\r\n\r\n```\r\n\r\nCan you guys please show me what i was wrong and what i need to do in the right way to use this plugin with webpack-merge?\r\nSomehow, i want to intergate this plugin into the `[auniversal-starter](https://github.com/angular/universal-starter)` for live reload\r\n\r\nThanks so much!"},"comment":{"url":"https://api.github.com/repos/glenjamin/webpack-hot-middleware/issues/comments/230707104","html_url":"https://github.com/glenjamin/webpack-hot-middleware/issues/116#issuecomment-230707104","issue_url":"https://api.github.com/repos/glenjamin/webpack-hot-middleware/issues/116","id":230707104,"user":{"login":"glenjamin","id":151272,"avatar_url":"https://avatars.githubusercontent.com/u/151272?v=3","gravatar_id":"","url":"https://api.github.com/users/glenjamin","html_url":"https://github.com/glenjamin","followers_url":"https://api.github.com/users/glenjamin/followers","following_url":"https://api.github.com/users/glenjamin/following{/other_user}","gists_url":"https://api.github.com/users/glenjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/glenjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glenjamin/subscriptions","organizations_url":"https://api.github.com/users/glenjamin/orgs","repos_url":"https://api.github.com/users/glenjamin/repos","events_url":"https://api.github.com/users/glenjamin/events{/privacy}","received_events_url":"https://api.github.com/users/glenjamin/received_events","type":"User","site_admin":false},"created_at":"2016-07-06T08:14:14Z","updated_at":"2016-07-06T08:14:14Z","body":"Ah, I see the problem now - you've added the middleware client to the server and the client.\r\n\r\nIt should only be in the client bundle."}}
{"actor":{"display_login":"glenjamin"}}