{"action":"created","issue":{"url":"https://api.github.com/repos/greensock/GreenSock-JS/issues/168","repository_url":"https://api.github.com/repos/greensock/GreenSock-JS","labels_url":"https://api.github.com/repos/greensock/GreenSock-JS/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/greensock/GreenSock-JS/issues/168/comments","events_url":"https://api.github.com/repos/greensock/GreenSock-JS/issues/168/events","html_url":"https://github.com/greensock/GreenSock-JS/issues/168","id":168767299,"number":168,"title":"What is the correct way to load GSAP with Webpack?","user":{"login":"bishopZ","id":1138587,"avatar_url":"https://avatars.githubusercontent.com/u/1138587?v=3","gravatar_id":"","url":"https://api.github.com/users/bishopZ","html_url":"https://github.com/bishopZ","followers_url":"https://api.github.com/users/bishopZ/followers","following_url":"https://api.github.com/users/bishopZ/following{/other_user}","gists_url":"https://api.github.com/users/bishopZ/gists{/gist_id}","starred_url":"https://api.github.com/users/bishopZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bishopZ/subscriptions","organizations_url":"https://api.github.com/users/bishopZ/orgs","repos_url":"https://api.github.com/users/bishopZ/repos","events_url":"https://api.github.com/users/bishopZ/events{/privacy}","received_events_url":"https://api.github.com/users/bishopZ/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-08-01T23:42:33Z","updated_at":"2016-08-02T01:39:44Z","closed_at":null,"body":"When I load GSAP with webpack, I get the error \r\n`_doc = document; document is not defined.`\r\n\r\n[This page](http://webpack.github.io/docs/shimming-modules.html) suggests several ways to \"shim\" modules. But none of them are working for me.\r\n\r\n[This forum thread](http://greensock.com/forums/topic/11484-using-gsap-with-nodejs/) suggests some ways to shim the module to be compatible with ES6 import statements and works if \"global\" is defined in the node environment.\r\n\r\nI don't see a clear solution. Any help appreciated. "},"comment":{"url":"https://api.github.com/repos/greensock/GreenSock-JS/issues/comments/236767023","html_url":"https://github.com/greensock/GreenSock-JS/issues/168#issuecomment-236767023","issue_url":"https://api.github.com/repos/greensock/GreenSock-JS/issues/168","id":236767023,"user":{"login":"bishopZ","id":1138587,"avatar_url":"https://avatars.githubusercontent.com/u/1138587?v=3","gravatar_id":"","url":"https://api.github.com/users/bishopZ","html_url":"https://github.com/bishopZ","followers_url":"https://api.github.com/users/bishopZ/followers","following_url":"https://api.github.com/users/bishopZ/following{/other_user}","gists_url":"https://api.github.com/users/bishopZ/gists{/gist_id}","starred_url":"https://api.github.com/users/bishopZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bishopZ/subscriptions","organizations_url":"https://api.github.com/users/bishopZ/orgs","repos_url":"https://api.github.com/users/bishopZ/repos","events_url":"https://api.github.com/users/bishopZ/events{/privacy}","received_events_url":"https://api.github.com/users/bishopZ/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T01:39:43Z","updated_at":"2016-08-02T01:39:43Z","body":"My other JSX modules are and have been working fine. I am not having any issues with React or Babel. I did however have a very similar issue with Bootstrap requiring access to the window object. I also spoke with someone on the Webpack Gitter Chat that was having a similar issue with the library Backbone needing access to window.\r\n\r\nI am guessing that there is some Webpack magic that allows this. The [Webpack docs](http://webpack.github.io/docs/shimming-modules.html) suggest that the imports-loader may allow this, but I have not found a working example of the imports-loader.\r\n\r\nTheir docs suggest that I should be able to load GSAP something like this\r\n```\r\nimport GSAP from 'imports?window=window,document=document!gsap';\r\n```\r\n\r\nThe chatter from Webpack Gitter Chat and I have both attempted this. Him with backbone and me with GSAP. In both cases the error is \"Cannot find module\" which means that imports-loader did not run. I have created [an issue on the imports-loader repo](https://github.com/webpack/imports-loader/issues/29).\r\n\r\nYou could argue that since the issue happens with multiple libraries that it is not specifically a GSAP thing. Although, based on the forum thread I mentioned earlier, other GSAP users are also having this issue, and [the currently published solution](http://greensock.com/forums/topic/11484-using-gsap-with-nodejs/) is less than ideal."}}
{"actor":{"display_login":"bishopZ"}}