Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling of HMR in the webpack plugin #1247

Open
3 tasks done
MadEmperorYuri opened this issue Oct 21, 2019 · 0 comments
Open
3 tasks done

Allow disabling of HMR in the webpack plugin #1247

MadEmperorYuri opened this issue Oct 21, 2019 · 0 comments
Labels
enhancement plugin/webpack Issues or pull requests related to first-party webpack plugins/templates

Comments

@MadEmperorYuri
Copy link

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

I'm trying to figure out how to disable HMR using Electron Forge with the Webpack template. This is basically the same question as in #565, which, although it got the answer it needed, did not get the answer to the question that was asked.

I have tried adding devServer: { hot: false, inline: false } to Webpack's renderer configuration file, but this did not work. In the course of googling, I think I ran across some page that said devServer configuration would be ignored because of how Electron Forge arranges things, but I cannot find that article again.

What does your config.forge data in package.json look like?

"forge": {
      "packagerConfig": {},
      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "neo4j_client"
          }
        },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ],
      "plugins": [
        [
          "@electron-forge/plugin-webpack",
          {
            "mainConfig": "./webpack.main.config.js",
            "renderer": {
              "config": "./webpack.renderer.config.js",
              "entryPoints": [
                {
                  "html": "./source/Renderer/Window/Main/Main.html",
                  "js": "./source/Renderer/Window/Main/Main.tsx",
                  "name": "Main"
                }
              ]
            }
          }
        ]
      ]
    }

webpack.renderer.config.js with devServer configuration

const rules = require('./webpack.rules');
const plugins = require('./webpack.plugins');

rules.push({
  test: /\.scss$/,
  use: [{ loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'sass-loader' }],
});

rules.push({
  test: /\.css$/,
  use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
});

rules.push({
  test: /\.tsv$/,
  use: [{ loader: 'file-loader' }],
});

module.exports = {
  // Put your normal webpack config below here
  module: {
    rules,
  },
  resolve: {
    extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.scss', 'tsv']
  },
  devServer: {
    hot: false,
    inline: false,
  }
};

package-lock.json versions

"@electron-forge/cli": {
      "version": "6.0.0-beta.45",
...
"@electron-forge/core": {
      "version": "6.0.0-beta.45"
...
"@electron-forge/plugin-webpack": {
      "version": "6.0.0-beta.45",
...
"@electron-forge/template-webpack": {
      "version": "6.0.0-beta.45",
...
"electron": {
      "version": "6.0.12",
...
"webpack": {
      "version": "4.41.1",

All running with Node v10.16.3 and NPM v6.12.0.

Thanks very much for your time and attention, I appreciate it.

@malept malept added the plugin/webpack Issues or pull requests related to first-party webpack plugins/templates label Jan 23, 2020
@MarshallOfSound MarshallOfSound changed the title Removing HMR (again) Allow disabling of HMR in the webpack plugin Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement plugin/webpack Issues or pull requests related to first-party webpack plugins/templates
Projects
None yet
Development

No branches or pull requests

3 participants