{"action":"created","issue":{"url":"https://api.github.com/repos/zeit/next.js/issues/532","repository_url":"https://api.github.com/repos/zeit/next.js","labels_url":"https://api.github.com/repos/zeit/next.js/issues/532/labels{/name}","comments_url":"https://api.github.com/repos/zeit/next.js/issues/532/comments","events_url":"https://api.github.com/repos/zeit/next.js/issues/532/events","html_url":"https://github.com/zeit/next.js/issues/532","id":197637538,"number":532,"title":"Cannot alias React","user":{"login":"lukeed","id":5855893,"avatar_url":"https://avatars.githubusercontent.com/u/5855893?v=3","gravatar_id":"","url":"https://api.github.com/users/lukeed","html_url":"https://github.com/lukeed","followers_url":"https://api.github.com/users/lukeed/followers","following_url":"https://api.github.com/users/lukeed/following{/other_user}","gists_url":"https://api.github.com/users/lukeed/gists{/gist_id}","starred_url":"https://api.github.com/users/lukeed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukeed/subscriptions","organizations_url":"https://api.github.com/users/lukeed/orgs","repos_url":"https://api.github.com/users/lukeed/repos","events_url":"https://api.github.com/users/lukeed/events{/privacy}","received_events_url":"https://api.github.com/users/lukeed/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-12-27T02:55:13Z","updated_at":"2016-12-27T23:16:39Z","closed_at":"2016-12-27T23:16:39Z","body":"After #222 & using the latest `master` branch (`2.0.0-beta.3`) it's impossible to fully omit React from the next bundles. \r\n\r\nUsing this `next.config.js`: \r\n\r\n```js\r\nmodule.exports = {\r\n  webpack: (cfg, { dev }) => {\r\n\t\tcfg.resolve.alias = {\r\n\t\t\t'react': 'preact-compat',\r\n\t\t\t'react-dom': 'preact-compat'\r\n\t\t}\r\n    return cfg\r\n  }\r\n}\r\n```\r\n\r\nIn doing so, the `commons.js` output contains all Next.js pre-built code, including React. It **also** contains `preact` and `preact-compat`. Having both React & Preact within the same bundle makes the alias redundant and pointless.\r\n\r\n### Possible Solutions\r\n\r\n1. Ship Next.js without the `dist` folder. Instead, build the library within `next build` _before_ building the application code. This will also require that the new `build` process adheres to the same `next.config.js` configuration (user + defaults) all throughout. \r\n\r\n2. Add a `jsnext:main` entry with a myriad of module`import`/`export` statements so that we may bypass the pre-builts & handle the build process ourselves (above).\r\n\r\nBoth venture further into \"userland\", but they're also both completely opt-in. The unaware / unwanting dev should not & will not be affected.\r\n\r\nAlso, I thought this was the promise of #222 until I saw that my bundles fattened. For a second, t'was comforting to know that it wasn't just me over the holidays..."},"comment":{"url":"https://api.github.com/repos/zeit/next.js/issues/comments/269396557","html_url":"https://github.com/zeit/next.js/issues/532#issuecomment-269396557","issue_url":"https://api.github.com/repos/zeit/next.js/issues/532","id":269396557,"user":{"login":"lukeed","id":5855893,"avatar_url":"https://avatars.githubusercontent.com/u/5855893?v=3","gravatar_id":"","url":"https://api.github.com/users/lukeed","html_url":"https://github.com/lukeed","followers_url":"https://api.github.com/users/lukeed/followers","following_url":"https://api.github.com/users/lukeed/following{/other_user}","gists_url":"https://api.github.com/users/lukeed/gists{/gist_id}","starred_url":"https://api.github.com/users/lukeed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukeed/subscriptions","organizations_url":"https://api.github.com/users/lukeed/orgs","repos_url":"https://api.github.com/users/lukeed/repos","events_url":"https://api.github.com/users/lukeed/events{/privacy}","received_events_url":"https://api.github.com/users/lukeed/received_events","type":"User","site_admin":false},"created_at":"2016-12-27T23:16:39Z","updated_at":"2016-12-27T23:16:39Z","body":"I cleared cache & rebuilt; and it wasn't there 😄 \r\n\r\nThanks for taking care of this 👍 Now I have to investigate if `commons` can be smaller 😉 "}}
{"actor":{"display_login":"lukeed"}}