{"action":"created","issue":{"url":"https://api.github.com/repos/JeffreyWay/laravel-mix/issues/468","repository_url":"https://api.github.com/repos/JeffreyWay/laravel-mix","labels_url":"https://api.github.com/repos/JeffreyWay/laravel-mix/issues/468/labels{/name}","comments_url":"https://api.github.com/repos/JeffreyWay/laravel-mix/issues/468/comments","events_url":"https://api.github.com/repos/JeffreyWay/laravel-mix/issues/468/events","html_url":"https://github.com/JeffreyWay/laravel-mix/issues/468","id":210103801,"number":468,"title":"Mixing single JS file not creating expected file","user":{"login":"PauBenetPrat","id":8748692,"avatar_url":"https://avatars.githubusercontent.com/u/8748692?v=3","gravatar_id":"","url":"https://api.github.com/users/PauBenetPrat","html_url":"https://github.com/PauBenetPrat","followers_url":"https://api.github.com/users/PauBenetPrat/followers","following_url":"https://api.github.com/users/PauBenetPrat/following{/other_user}","gists_url":"https://api.github.com/users/PauBenetPrat/gists{/gist_id}","starred_url":"https://api.github.com/users/PauBenetPrat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PauBenetPrat/subscriptions","organizations_url":"https://api.github.com/users/PauBenetPrat/orgs","repos_url":"https://api.github.com/users/PauBenetPrat/repos","events_url":"https://api.github.com/users/PauBenetPrat/events{/privacy}","received_events_url":"https://api.github.com/users/PauBenetPrat/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-24T17:05:09Z","updated_at":"2017-02-26T19:30:48Z","closed_at":"2017-02-26T19:30:48Z","body":"I'm compiling a test.js file located on my resources and the output generated file doesn't work.\r\n\r\nI've just created a new laravel5.4 project from scratch. Created `resources/assets/js/test.js`with a single function:\r\n```\r\nfunction testFunction() {\r\n    console.log('test');\r\n}\r\n```\r\n\r\nI've cleaned welcome.blade and instead I simply import js/test.js script from public folder and execute my function\r\n```\r\n<!DOCTYPE html>\r\n<html lang=\"{{ config('app.locale') }}\">\r\n    <head>\r\n        <script src=\"{{ url(\"js/test.js\") }}\"></script>\r\n    </head>\r\n    <body>\r\n    <script>\r\n        testFunction();\r\n    </script>\r\n    </body>\r\n</html>\r\n```\r\n\r\nOn my webpack.mix I'm only compiling test.js\r\n`mix.js('resources/assets/js/test.js', 'public/js');`\r\n\r\nIt compiles succesfully but when I visit welcome page I receive \r\n`testFunction is not defined`\r\n\r\nAny idea what's going on? On inspector I can see that my js is loading ok too. \r\n"},"comment":{"url":"https://api.github.com/repos/JeffreyWay/laravel-mix/issues/comments/282580367","html_url":"https://github.com/JeffreyWay/laravel-mix/issues/468#issuecomment-282580367","issue_url":"https://api.github.com/repos/JeffreyWay/laravel-mix/issues/468","id":282580367,"user":{"login":"JeffreyWay","id":183223,"avatar_url":"https://avatars.githubusercontent.com/u/183223?v=3","gravatar_id":"","url":"https://api.github.com/users/JeffreyWay","html_url":"https://github.com/JeffreyWay","followers_url":"https://api.github.com/users/JeffreyWay/followers","following_url":"https://api.github.com/users/JeffreyWay/following{/other_user}","gists_url":"https://api.github.com/users/JeffreyWay/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffreyWay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffreyWay/subscriptions","organizations_url":"https://api.github.com/users/JeffreyWay/orgs","repos_url":"https://api.github.com/users/JeffreyWay/repos","events_url":"https://api.github.com/users/JeffreyWay/events{/privacy}","received_events_url":"https://api.github.com/users/JeffreyWay/received_events","type":"User","site_admin":false},"created_at":"2017-02-26T19:30:48Z","updated_at":"2017-02-26T19:30:48Z","body":"When it compiles, it won't automatically be in the global space. You have to explicitly request that.\r\n\r\n```js\r\nwindow.testFunction = function () {\r\n    console.log('test');\r\n}\r\n```"}}
{"actor":{"display_login":"JeffreyWay"}}