{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/47","labels_url":"https://api.github.com/repos/airbnb/enzyme/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/enzyme/issues/47/comments","events_url":"https://api.github.com/repos/airbnb/enzyme/issues/47/events","html_url":"https://github.com/airbnb/enzyme/issues/47","id":120458694,"number":47,"title":"Webpack build issues","user":{"login":"kgoggin","id":4549617,"avatar_url":"https://avatars.githubusercontent.com/u/4549617?v=3","gravatar_id":"","url":"https://api.github.com/users/kgoggin","html_url":"https://github.com/kgoggin","followers_url":"https://api.github.com/users/kgoggin/followers","following_url":"https://api.github.com/users/kgoggin/following{/other_user}","gists_url":"https://api.github.com/users/kgoggin/gists{/gist_id}","starred_url":"https://api.github.com/users/kgoggin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgoggin/subscriptions","organizations_url":"https://api.github.com/users/kgoggin/orgs","repos_url":"https://api.github.com/users/kgoggin/repos","events_url":"https://api.github.com/users/kgoggin/events{/privacy}","received_events_url":"https://api.github.com/users/kgoggin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/airbnb/enzyme/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"lelandrichardson","id":1885623,"avatar_url":"https://avatars.githubusercontent.com/u/1885623?v=3","gravatar_id":"","url":"https://api.github.com/users/lelandrichardson","html_url":"https://github.com/lelandrichardson","followers_url":"https://api.github.com/users/lelandrichardson/followers","following_url":"https://api.github.com/users/lelandrichardson/following{/other_user}","gists_url":"https://api.github.com/users/lelandrichardson/gists{/gist_id}","starred_url":"https://api.github.com/users/lelandrichardson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lelandrichardson/subscriptions","organizations_url":"https://api.github.com/users/lelandrichardson/orgs","repos_url":"https://api.github.com/users/lelandrichardson/repos","events_url":"https://api.github.com/users/lelandrichardson/events{/privacy}","received_events_url":"https://api.github.com/users/lelandrichardson/received_events","type":"User","site_admin":false},"milestone":null,"comments":26,"created_at":"2015-12-04T18:29:30Z","updated_at":"2015-12-17T12:34:31Z","closed_at":null,"body":"I'm trying to get enzyme working using a pretty standard webpack/karma setup. Webpack throws a bunch of errors related to the dependencies enzyme imports, including sinon, cheerio, and jsdom. Sinon gives webpack heartburn because it uses it's own `require` (which seems to be documented here: https://github.com/webpack/webpack/issues/304), and then there are a bunch of \"Module not found\" errors for jsdom and cheerio.\r\n\r\nI'm importing enzyme as described in the docs and can't really think of anything else I might be missing, so I'm curious if anyone else is trying to use webpack and running into a similar issue, or if there's just something weird with my configuration. I'd expect to be able to just import it and have it work, but maybe I need to do something with those external libraries?\r\n\r\nHere's my test file for reference:\r\n\r\n```javascript\r\nimport expect from 'expect';\r\nimport { shallow } from 'enzyme';\r\nimport React from 'react';\r\nimport Button from '../Button';\r\n\r\ndescribe('Button', () => {\r\n\tit('should render children passed in', () => {\r\n\t\tconst wrapper = shallow(\r\n\t\t\t<Button><div className=\"foo\" /></Button>\r\n\t\t);\r\n\r\n\t\texpect(wrapper.contains(<div className=\"foo\" />)).toBe(true);\r\n\t});\r\n});\r\n```\r\n\r\nI won't paste the entire error log from webpack because it's pretty long, but here's a sample: \r\n\r\n```\r\n\r\nWARNING in ./~/enzyme/~/jsdom/~/acorn/dist/acorn.js\r\nCritical dependencies:\r\n1:478-485 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.\r\n @ ./~/enzyme/~/jsdom/~/acorn/dist/acorn.js 1:478-485\r\n\r\nWARNING in ./~/enzyme/~/jsdom/~/acorn/dist/walk.js\r\nCritical dependencies:\r\n1:503-510 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.\r\n @ ./~/enzyme/~/jsdom/~/acorn/dist/walk.js 1:503-510\r\n\r\nERROR in ./~/enzyme/build/react-compat.js\r\nModule not found: Error: Cannot resolve module 'react/lib/ExecutionEnvironment' in /Users/agoggin/www/vhosts/hammerhead/node_modules/enzyme/build\r\n @ ./~/enzyme/build/react-compat.js 22:2-43\r\n\r\nERROR in ./~/enzyme/~/cheerio/index.js\r\nModule not found: Error: Cannot resolve module 'json' in /Users/agoggin/www/vhosts/hammerhead/node_modules/enzyme/node_modules/cheerio\r\n @ ./~/enzyme/~/cheerio/index.js 11:18-38\r\n\r\nERROR in ./~/enzyme/~/jsdom/lib/jsdom.js\r\nModule not found: Error: Cannot resolve module 'fs' in /Users/agoggin/www/vhosts/hammerhead/node_modules/enzyme/node_modules/jsdom/lib\r\n @ ./~/enzyme/~/jsdom/lib/jsdom.js 6:9-22\r\n```\r\n\r\nMy webpack/karma config is pretty vanilla, but it'd help I can post that, too. "},"comment":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/comments/165440888","html_url":"https://github.com/airbnb/enzyme/issues/47#issuecomment-165440888","issue_url":"https://api.github.com/repos/airbnb/enzyme/issues/47","id":165440888,"user":{"login":"liorbrauer","id":1526276,"avatar_url":"https://avatars.githubusercontent.com/u/1526276?v=3","gravatar_id":"","url":"https://api.github.com/users/liorbrauer","html_url":"https://github.com/liorbrauer","followers_url":"https://api.github.com/users/liorbrauer/followers","following_url":"https://api.github.com/users/liorbrauer/following{/other_user}","gists_url":"https://api.github.com/users/liorbrauer/gists{/gist_id}","starred_url":"https://api.github.com/users/liorbrauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liorbrauer/subscriptions","organizations_url":"https://api.github.com/users/liorbrauer/orgs","repos_url":"https://api.github.com/users/liorbrauer/repos","events_url":"https://api.github.com/users/liorbrauer/events{/privacy}","received_events_url":"https://api.github.com/users/liorbrauer/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T12:34:31Z","updated_at":"2015-12-17T12:34:31Z","body":"@smacker @vyorkin @lecstor thank you all! :) that fixed my last error. "}}