{"action":"created","issue":{"url":"https://api.github.com/repos/webpack-contrib/webpack-hot-client/issues/36","repository_url":"https://api.github.com/repos/webpack-contrib/webpack-hot-client","labels_url":"https://api.github.com/repos/webpack-contrib/webpack-hot-client/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/webpack-contrib/webpack-hot-client/issues/36/comments","events_url":"https://api.github.com/repos/webpack-contrib/webpack-hot-client/issues/36/events","html_url":"https://github.com/webpack-contrib/webpack-hot-client/issues/36","id":307128703,"number":36,"title":"hot-client should also be available with target \"electron-renderer\"","user":{"login":"Rocket1184","id":13914967,"avatar_url":"https://avatars3.githubusercontent.com/u/13914967?v=4","gravatar_id":"","url":"https://api.github.com/users/Rocket1184","html_url":"https://github.com/Rocket1184","followers_url":"https://api.github.com/users/Rocket1184/followers","following_url":"https://api.github.com/users/Rocket1184/following{/other_user}","gists_url":"https://api.github.com/users/Rocket1184/gists{/gist_id}","starred_url":"https://api.github.com/users/Rocket1184/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rocket1184/subscriptions","organizations_url":"https://api.github.com/users/Rocket1184/orgs","repos_url":"https://api.github.com/users/Rocket1184/repos","events_url":"https://api.github.com/users/Rocket1184/events{/privacy}","received_events_url":"https://api.github.com/users/Rocket1184/received_events","type":"User","site_admin":false},"labels":[{"id":848322776,"url":"https://api.github.com/repos/webpack-contrib/webpack-hot-client/labels/c%C2%B9%20%E2%8B%85%20discussion","name":"c¹ ⋅ discussion","color":"1976D2","default":false},{"id":848322785,"url":"https://api.github.com/repos/webpack-contrib/webpack-hot-client/labels/kind%20%E2%9C%A8%20enhancement","name":"kind ✨ enhancement","color":"18AEFF","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-03-21T06:04:31Z","updated_at":"2018-03-23T17:37:13Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n  Please note that this template is not optional.\r\n  Please fill out _ALL_ fields, or your issue may be closed as \"invalid.\"\r\n  Please do not delete this template.\r\n  Please ask questions on StackOverflow or Gitter (https://gitter.im/webpack/webpack).\r\n  General questions, how-to questions, and support requests will be closed.\r\n-->\r\n\r\n* Operating System: Arch Linux 4.15.10-1-ARCH x86_64\r\n* Node Version: 9.8.0\r\n* NPM Version: 5.7.1\r\n* webpack Version: 4.1.1\r\n* webpack-hot-client Version: 2.0.0\r\n\r\n<!-- Please place an x, no spaces, in all [ ] that apply -->\r\n\r\n- [ ] This is a **bug**\r\n- [ ] This is a **feature** request\r\n- [x] This is a **modification** request\r\n\r\n\r\nI'm struggling on build a development envirement with Electron and HMR enabled, so the `config.target` was set to `\"electron-renderer\"`.  The `dev-server.js` below aims to start server with hot reload, so I chose `webpack-serve`. However when I create Electron `BorwserWindow` points to that server address, not-reload not presented as expected.\r\n\r\nhttps://github.com/webpack-contrib/webpack-hot-client/blob/0d409f4e963465f2af3e37f8de6ac12e5221eb98/lib/util.js#L9-L11\r\n\r\ncode above seems to provide hot-client to target `\"web\"` only. After deleted those lines in my local node_modules, hot-reload seems to work.\r\n\r\nso why `\"electron-renderer\"` is not accepted by default? Is it by design, or just other reasons?\r\n\r\n### Code\r\n\r\n<!--\r\n  If you have a large amount of code to share which demonstrates the problem\r\n  you're experiencing, or your webpack config is very large, please provide a link\r\n  to your repository rather than pasting code. We'd also encourage you to use a\r\n  Github Gist link instead of pasting code. Otherwise, please paste relevant\r\n  short snippets below.\r\n\r\n  For bugs, please do consider providing a link to a stripped-down, bare-bones\r\n  repo that can reproduce the problem you're experiencing. Many times, bugs\r\n  aren't actual bugs, but rather specific issues with loaders, plugins, or\r\n  an environment/OS. Problems with complicated or large applications will almost\r\n  always require this to be triaged.\r\n-->\r\n\r\n<details>\r\n\r\n<summary>webpack.config.renderer.js</summary>\r\n\r\n```js\r\n'use strict';\r\n\r\nconst webpack = require('webpack');\r\nconst packageJson = require('../package.json');\r\nconst ExtractTextPlugin = require('extract-text-webpack-plugin');\r\n\r\nconst { absPath, DefaultEnv } = require('./util');\r\n\r\nlet cfg = {\r\n    mode: DefaultEnv,\r\n    context: absPath('src/renderer'),\r\n    target: 'electron-renderer',\r\n    entry: {\r\n        renderer: ['./index.tsx']\r\n    },\r\n    output: {\r\n        path: absPath('dist/static'),\r\n        filename: '[name].js'\r\n    },\r\n    resolve: {\r\n        extensions: ['.js', '.ts', '.tsx', '.json'],\r\n    },\r\n    performance: {\r\n        hints: false\r\n    },\r\n    module: {\r\n        rules: [\r\n            {\r\n                test: /\\.css$/,\r\n                use: ExtractTextPlugin.extract({\r\n                    fallback: 'style-loader',\r\n                    use: 'css-loader'\r\n                })\r\n            },\r\n            {\r\n                test: /\\.less$/,\r\n                use: ExtractTextPlugin.extract({\r\n                    fallback: 'style-loader',\r\n                    use: ['css-loader', 'less-loader']\r\n                })\r\n            },\r\n            {\r\n                test: /\\.ts$/,\r\n                use: 'ts-loader',\r\n                exclude: /node_modules/\r\n            },\r\n            {\r\n                test: /\\.tsx$/,\r\n                use: [\r\n                    {\r\n                        loader: 'babel-loader',\r\n                        options: {\r\n                            babelrc: false,\r\n                            plugins: [\r\n                                \"babel-plugin-syntax-jsx\",\r\n                                [\"babel-plugin-inferno\", { imports: true }]\r\n                            ]\r\n                        }\r\n                    },\r\n                    'ts-loader'\r\n                ],\r\n                exclude: /node_modules/\r\n            },\r\n            {\r\n                test: /\\.(png|jpe?g|gif|svg)(\\?.*)?$/,\r\n                use: {\r\n                    loader: 'file-loader',\r\n                    query: {\r\n                        name: 'imgs/[name].[ext]'\r\n                    }\r\n                }\r\n            },\r\n            {\r\n                test: /\\.(woff2?|eot|ttf|otf)(\\?.*)?$/,\r\n                use: {\r\n                    loader: 'file-loader',\r\n                    query: {\r\n                        name: 'fonts/[name].[ext]'\r\n                    }\r\n                }\r\n            }\r\n        ]\r\n    },\r\n    plugins: [\r\n        new ExtractTextPlugin('styles.css')\r\n    ]\r\n};\r\n```\r\n\r\n</details>\r\n\r\n<details>\r\n\r\n<summary>util.js</summary>\r\n\r\n```js\r\n'use strict';\r\n\r\nconst { join } = require('path');\r\n\r\nconst DefaultEnv = process.env.NODE_ENV || 'development';\r\nconst ProjectRoot = join(__dirname, '..');\r\n\r\nfunction absPath(...paths) {\r\n    return join(ProjectRoot, ...paths);\r\n}\r\n\r\nmodule.exports = {\r\n    DefaultEnv,\r\n    absPath\r\n};\r\n```\r\n\r\n</details>\r\n\r\n<details>\r\n\r\n<summary>dev-server.js</summary>\r\n\r\n```js\r\nconst rendererCfg = require('./webpack.config.renderer');\r\n\r\nconst serve = { host: '127.0.0.1', port: 5146 };\r\nconst hot = { host: '127.0.0.1', port: 5147 };\r\n\r\nWebpackServe({\r\n    config: rendererCfg,\r\n    clipboard: false,\r\n    hot: hot,\r\n    ...serve\r\n});\r\n```\r\n\r\n</details>\r\n\r\n### Expected Behavior\r\n\r\nhot-client should also work with target `\"electron-renderer\"`\r\n\r\n### Actual Behavior\r\n\r\nthere won't be hot-reload with target `\"electron-renderer\"`\r\n"},"comment":{"url":"https://api.github.com/repos/webpack-contrib/webpack-hot-client/issues/comments/375744671","html_url":"https://github.com/webpack-contrib/webpack-hot-client/issues/36#issuecomment-375744671","issue_url":"https://api.github.com/repos/webpack-contrib/webpack-hot-client/issues/36","id":375744671,"user":{"login":"jeremejevs","id":2584727,"avatar_url":"https://avatars1.githubusercontent.com/u/2584727?v=4","gravatar_id":"","url":"https://api.github.com/users/jeremejevs","html_url":"https://github.com/jeremejevs","followers_url":"https://api.github.com/users/jeremejevs/followers","following_url":"https://api.github.com/users/jeremejevs/following{/other_user}","gists_url":"https://api.github.com/users/jeremejevs/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremejevs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremejevs/subscriptions","organizations_url":"https://api.github.com/users/jeremejevs/orgs","repos_url":"https://api.github.com/users/jeremejevs/repos","events_url":"https://api.github.com/users/jeremejevs/events{/privacy}","received_events_url":"https://api.github.com/users/jeremejevs/received_events","type":"User","site_admin":false},"created_at":"2018-03-23T17:37:13Z","updated_at":"2018-03-23T17:37:13Z","author_association":"NONE","body":"From your last comment in the PR:\r\n\r\n> you're going to be using this outside the intended environment\r\n\r\nThis is the core of the problem. The intended environment should be \"every browser-like target of Webpack\", and then there should be \"use at your own risk\" support of other targets. Why the axiom of \"`web` only\"?\r\n\r\nAnd this is getting pretty rude :slightly_smiling_face: You keep responding with \"not going to happen\" instead of providing rationale, and now I'm getting an ELI5 version of it. I'm out."}}
{"actor":{"display_login":"jeremejevs"}}