question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML file not load `index.js` when in Multiple Pages mode

See original GitHub issue

version: 2.0.0-rc.6

After running yarn electron:serve, HTML file does not load index.js when in Multiple Pages mode.

Alaways reproduce when checking with browser or electron (browser sreenshot).

图片

while after running yarn serve, everything goes fine (browser sreenshot):

图片

Here is my vue.config.js file:

const path = require('path');
const webAppEntry = 'src/drivers/ui/web/main.ts';
const alias = {
  entity: path.resolve(__dirname, 'src/domain/entity'),
  service: path.resolve(__dirname, 'src/domain/service'),
  repository: path.resolve(__dirname, 'src/domain/repository'),
  drivers: path.resolve(__dirname, 'src/drivers'),
};

module.exports = {
  pages: {
    index: {
      entry: webAppEntry,
      template: 'src/drivers/ui/web/public/index.html',
    },
  },
  configureWebpack: {
    resolve: { alias },
  },
  pluginOptions: {
    electronBuilder: {
      chainWebpackMainProcess: config => {
        Object.keys(alias).forEach(key => {
          config.resolve.alias.set(key, alias[key]);
        });
      },
      // @see https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/578#issuecomment-561972824
      externals: ['sequelize'],
      mainProcessFile: 'src/drivers/ui/electron/main.ts',
      rendererProcessFile: webAppEntry,
      mainProcessWatch: ['src/drivers/ui/electron/*'],
      mainProcessArgs: ['--arg-name', 'arg-value'],
    },
  },
};

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nklaymancommented, Mar 6, 2021

I think I’ll just remove it completely in favor of changing it through pages.index.entry in v3.

1reaction
nklaymancommented, Mar 4, 2021

Try removing the rendererProcessFile config from your vue.config.js. If that doesn’t work, I’m going to need a repo that demonstrates the error as I can’t replicate it myself. You can see https://github.com/nklayman/electron-multipage-example/ for an example as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you import multiple javascript files in HTML index file ...
7 Answers 7 · Add the following function in your web page. function loadScript(url) { var head = document.getElementsByTagName('head')[0]; var script = document....
Read more >
Tips for authoring fast-loading HTML pages - MDN Web Docs
These tips are based on common knowledge and experimentation.
Read more >
Static website, multiple html pages, using Webpack + example ...
Above we are reusing index.js file in every page with chunks: ['index'] to change this just add new Javascript files about.js ...
Read more >
Make multipage HTML development suck less with Pug
Create an app.js in the src/ folder. It can be blank. Doesn't matter. It also needs an initial pug file to compile. Create...
Read more >
Multiple Pages - SurviveJS
Go through the multi-compiler mode and return an array of configurations. The approach would work as long as the pages are separate, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found