{"action":"created","issue":{"url":"https://api.github.com/repos/nuxt/nuxt.js/issues/5260","repository_url":"https://api.github.com/repos/nuxt/nuxt.js","labels_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/5260/labels{/name}","comments_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/5260/comments","events_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/5260/events","html_url":"https://github.com/nuxt/nuxt.js/issues/5260","id":421907301,"node_id":"MDU6SXNzdWU0MjE5MDczMDE=","number":5260,"title":"Lots of unnecessary JavaScript in generated Nuxt static build","user":{"login":"sarahdayan","id":5370675,"node_id":"MDQ6VXNlcjUzNzA2NzU=","avatar_url":"https://avatars1.githubusercontent.com/u/5370675?v=4","gravatar_id":"","url":"https://api.github.com/users/sarahdayan","html_url":"https://github.com/sarahdayan","followers_url":"https://api.github.com/users/sarahdayan/followers","following_url":"https://api.github.com/users/sarahdayan/following{/other_user}","gists_url":"https://api.github.com/users/sarahdayan/gists{/gist_id}","starred_url":"https://api.github.com/users/sarahdayan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarahdayan/subscriptions","organizations_url":"https://api.github.com/users/sarahdayan/orgs","repos_url":"https://api.github.com/users/sarahdayan/repos","events_url":"https://api.github.com/users/sarahdayan/events{/privacy}","received_events_url":"https://api.github.com/users/sarahdayan/received_events","type":"User","site_admin":false},"labels":[{"id":882702378,"node_id":"MDU6TGFiZWw4ODI3MDIzNzg=","url":"https://api.github.com/repos/nuxt/nuxt.js/labels/cmty:bug-report","name":"cmty:bug-report","color":"f7b2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2019-03-17T10:41:12Z","updated_at":"2019-03-29T22:43:05Z","closed_at":null,"author_association":"NONE","body":"### Version\n\n[v2.4.5](https://github.com/nuxt.js/releases/tag/v2.4.5)\n\n### Reproduction link\n\n[https://github.com/dinerojs/dinerojs.com](https://github.com/dinerojs/dinerojs.com)\n\n### Steps to reproduce\n\n1. Generate a pre-rendered build with `nuxt generate` or `yarn generate`.\n2. Inspect the `_nuxt` directory and see the generated JavaScript files.\n\n### What is expected ?\n\nWhen pre-rendering my website with `nuxt generate`, I would expect my HTML to be pre-rendered and for all the JavaScript that's used for this purpose not to be in the final build.\n\nIn fewer words, I would expect the only JavaScript that ends up in the final build to be the one that's necessary for runtime, nothing else.\n\n### What is actually happening?\n\nPre-rendering the website fills the `_nuxt` directory with unnecessary and heavy JavaScript. The HTML files are appropriately rendered, but the built JavaScript contains unnecessary things like the Markdown parser, Highlight.js, Nuxt store, etc.\n\nAnother side effect of getting all that development JavaScript in the production build is that it tries to apply build-time logic at runtime (e.g., determining what sidebar item is active to open the right parent, doesn't work because trying to determine this from `this.$route`).\n\n### Additional comments?\n\nI'm not sure how to tell Nuxt how to differentiate what I'll need in my final bundle (e.g., code to handle collapsing menus) and what is only there for generation of HTML. I couldn't find it in the documentation.\n\nThere are some closed tickets on these topics (e.g., https://github.com/nuxt/nuxt.js/issues/2822) but they only offer hacky and incomplete workarounds. Using Cheerio to strip out unwanted generated code doesn't address the real issue (code that shouldn't be there in the first place), adds CI time, and doesn't account for the JavaScript that you do need to keep.\n\nThanks a lot in advance for your help! Been enjoying using Nuxt and this is likely the final hurdle before I can push my project live. 🙂\n\n<!--cmty--><!--cmty_prevent_hook-->\n<div align=\"right\"><sub><em>This bug report is available on <a href=\"https://cmty.app/nuxt\">Nuxt</a> community (<a href=\"https://cmty.app/nuxt/nuxt.js/issues/c8848\">#c8848</a>)</em></sub></div>"},"comment":{"url":"https://api.github.com/repos/nuxt/nuxt.js/issues/comments/478170989","html_url":"https://github.com/nuxt/nuxt.js/issues/5260#issuecomment-478170989","issue_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/5260","id":478170989,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3ODE3MDk4OQ==","user":{"login":"manniL","id":640208,"node_id":"MDQ6VXNlcjY0MDIwOA==","avatar_url":"https://avatars0.githubusercontent.com/u/640208?v=4","gravatar_id":"","url":"https://api.github.com/users/manniL","html_url":"https://github.com/manniL","followers_url":"https://api.github.com/users/manniL/followers","following_url":"https://api.github.com/users/manniL/following{/other_user}","gists_url":"https://api.github.com/users/manniL/gists{/gist_id}","starred_url":"https://api.github.com/users/manniL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manniL/subscriptions","organizations_url":"https://api.github.com/users/manniL/orgs","repos_url":"https://api.github.com/users/manniL/repos","events_url":"https://api.github.com/users/manniL/events{/privacy}","received_events_url":"https://api.github.com/users/manniL/received_events","type":"User","site_admin":false},"created_at":"2019-03-29T22:43:05Z","updated_at":"2019-03-29T22:43:05Z","author_association":"MEMBER","body":"@sarahdayan \tNo problem!\r\n\r\nYes, https://github.com/nuxt/rfcs/issues/22 is how every other static site generator works/should work and will be tightly coupled to `nuxt generate` (through a feature flag I'd guess) and likely default for `nuxt generate` in Nuxt 3.\r\n\r\nYou can use https://github.com/DreaMinder/nuxt-payload-extractor in the meantime to achieve a similar result (as mentioned in the RFC too) :+1:"}}
{"actor":{"display_login":"manniL"}}