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

Non-SPA Setup: Single Runtime Exists In All Chunks #178

Open
pxwee5 opened this issue May 13, 2019 · 1 comment
Open

Non-SPA Setup: Single Runtime Exists In All Chunks #178

pxwee5 opened this issue May 13, 2019 · 1 comment

Comments

@pxwee5
Copy link

pxwee5 commented May 13, 2019

Describe the bug

In non-spa setup, every entry needs to be added into the page with only a single runtime using the webpack option runtimeChunk: "single".

This will generate runtime.js for each entry. Like so

{
  "runtime": {
    "js": "/site/themes/raken-2.0/dist/runtime.1a9e8e42.js"
  },
  "main": {
    "js": [
      "/site/themes/raken-2.0/dist/runtime.1a9e8e42.js",
      "/site/themes/raken-2.0/dist/vendors~main.9b76b42c.bundle.js",
      "/site/themes/raken-2.0/dist/main.1653aa78.bundle.js"
    ]
  },
  "stylecss": {
    "js": [
      "/site/themes/raken-2.0/dist/runtime.1a9e8e42.js",
      "/site/themes/raken-2.0/dist/style.2a6967b4.bundle.js"
    ],
    "css": "/site/themes/raken-2.0/dist/style.3c41bfb5.css"
  },
  "utilcss": {
    "js": [
      "/site/themes/raken-2.0/dist/runtime.1a9e8e42.js",
      "/site/themes/raken-2.0/dist/utils.f8096f3c.bundle.js"
    ],
    "css": "/site/themes/raken-2.0/dist/utils.6ebc5c92.css"
  }
}

Is there a way to filter runtime.js from all entries except for the runtime entry?

Expected Output

{
  "runtime": {
    "js": "/site/themes/raken-2.0/dist/runtime.1a9e8e42.js"
  },
  "main": {
    "js": [
      "/site/themes/raken-2.0/dist/vendors~main.9b76b42c.bundle.js",
      "/site/themes/raken-2.0/dist/main.1653aa78.bundle.js"
    ]
  },
  "style": {
    "js": "/site/themes/raken-2.0/dist/style.2a6967b4.bundle.js",
    "css": "/site/themes/raken-2.0/dist/style.3c41bfb5.css"
  },
  "utils": {
    "js": "/site/themes/raken-2.0/dist/utils.f8096f3c.bundle.js",
    "css": "/site/themes/raken-2.0/dist/utils.6ebc5c92.css"
  }
}

What Have I Tried?

I cannot use the setting where runtimeChunk: false|multiple because that would generate multiple instances of HMR when loaded on the same page. This also make each entry contains a runtime which is also bad for performance.

@ztoben
Copy link
Owner

ztoben commented May 13, 2019

I could see this being provided by the plugin. I'd be interested to hear some other feedback to see if I could make a more generic solution for this, rather than providing an option for just this specific case.

I don't have much time to work on this plugin lately, so I'm not sure when I'll get around to working on this unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants