A file disappears after changing if I use "brunch watch"
See original GitHub issueDescription
I’m a beginner in Elixir/Phoenix/Brunch and probably I’m doing something wrong here, but I’ve got a strange behaviour of Brunch.
Steps:
- I create a new project using Phoenix framework:
mix phoenix.new
. - It contains
web/static/js/app.js
andweb/static/js/socket.js
files by default. - When I open Chrome Inspector I can see both files (from source maps) and combined
app.js
, containing content of both files. - I change
socket.js
in any manner, for example by adding a new line. - Brunch watcher detects the change and recompiles sources.
- I refresh the page and now I can see only
app.js
(from sm) and combinedapp.js
, not containing the content of socket.js. I also manually checkpriv/static/js/app.js
and it reflects the same.
So, the socket.js
file disappeared and will appear only after restarting brunch watch
or executing brunch build
.
Also I tested it with another file: I created test.js
and then changed it. It dissapeared from the combined file. As I see, this always affects exactly the file that I’m changing.
Sometimes it doesn’t happen after the first change, but after 2nd or 3rd.
In order to capture logs, I disabled the Brunch watcher in the Phoenix config and run it manually. Also I updated it to the latest version.
Environment
- Brunch: 2.6.6
- Node: 5.10.1
- NPM: 3.8.3
- Operating system: Ubuntu 15.10
package.json
contents
{
"repository": {
},
"dependencies": {
"babel-brunch": ">=6.0.0",
"brunch": ">=2.6.6",
"clean-css-brunch": ">=1.8.0",
"css-brunch": ">=1.7.0",
"javascript-brunch": ">=1.8.0",
"uglify-js-brunch": ">=1.7.0",
"phoenix": "file:deps/phoenix",
"phoenix_html": "file:deps/phoenix_html"
}
}
brunch config contents
exports.config = {
files: {
javascripts: {
joinTo: "js/app.js"
},
stylesheets: {
joinTo: "css/app.css"
},
templates: {
joinTo: "js/app.js"
}
},
conventions: {
assets: /^(web\/static\/assets)/
},
paths: {
watched: [
"web/static",
"test/static"
],
public: "priv/static"
},
plugins: {
babel: {
ignore: [/web\/static\/vendor/]
}
},
modules: {
autoRequire: {
"js/app.js": ["web/static/js/app"]
}
},
npm: {
enabled: true,
whitelist: ["phoenix", "phoenix_html"]
}
};
Other useful files, when present (bower.json
etc.)
Logs of watch -d
- I’ve been changing only
socket.js
several times:
$ node_modules/brunch/bin/brunch watch -d
brunch:config Trying to load brunch-config +0ms
brunch:plugins Loaded plugins: babel-brunch, css-brunch, javascript-brunch +457ms
brunch:watch add package.json +19ms
brunch:watch add brunch-config.js +0ms
brunch:watch add web/static/assets/favicon.ico +14ms
brunch:asset Init web/static/assets/favicon.ico directory=web/static/assets/ destPath=priv/static/favicon.ico rel=favicon.ico +1ms
brunch:watch add web/static/assets/robots.txt +2ms
brunch:asset Init web/static/assets/robots.txt directory=web/static/assets/ destPath=priv/static/robots.txt rel=robots.txt +0ms
brunch:watch add web/static/css/app.css +1ms
brunch:list Reading web/static/css/app.css +0ms
brunch:watch add web/static/js/app.js +0ms
brunch:list Reading web/static/js/app.js +1ms
brunch:watch add web/static/js/socket.js +0ms
brunch:list Reading web/static/js/socket.js +0ms
brunch:asset Copied web/static/assets/favicon.ico +7ms
brunch:asset Copied web/static/assets/robots.txt +1ms
brunch:file Init web/static/css/app.css: isntModule=false isWrapped=false +1ms
brunch:pipeline Compiling web/static/css/app.css @ CSSCompiler +2ms
brunch:list Compiled web/static/css/app.css +2ms
brunch:file Init web/static/js/app.js: isntModule=false isWrapped=true +0ms
brunch:pipeline Compiling web/static/js/app.js @ BabelCompiler +1ms
brunch:pipeline Compiling web/static/js/app.js @ JavaScriptCompiler +168ms
brunch:file Init web/static/js/socket.js: isntModule=false isWrapped=true +18ms
brunch:pipeline Compiling web/static/js/socket.js @ BabelCompiler +0ms
brunch:pipeline Compiling web/static/js/socket.js @ JavaScriptCompiler +101ms
brunch:watch add web/static/assets/images/phoenix.png +32ms
brunch:asset Init web/static/assets/images/phoenix.png directory=web/static/assets/ destPath=priv/static/images/phoenix.png rel=images/phoenix.png +0ms
brunch:asset Copied web/static/assets/images/phoenix.png +15ms
brunch:list Reading node_modules/phoenix_html/priv/static/phoenix_html.js +58ms
brunch:modules Wrapping web/static/js/app.js @ commonjs +9ms
brunch:file Generated source map for 'web/static/js/app.js' +1ms
brunch:list Compiled web/static/js/app.js +6ms
brunch:list Reading node_modules/phoenix/priv/static/phoenix.js +2ms
brunch:modules Wrapping web/static/js/socket.js @ commonjs +32ms
brunch:file Generated source map for 'web/static/js/socket.js' +1ms
brunch:list Compiled web/static/js/socket.js +29ms
brunch:file Init node_modules/phoenix_html/priv/static/phoenix_html.js: isntModule=true isWrapped=true +0ms
brunch:file Init node_modules/phoenix/priv/static/phoenix.js: isntModule=true isWrapped=true +0ms
brunch:modules Not wrapping (is vendor file) node_modules/phoenix_html/priv/static/phoenix_html.js +70ms
brunch:list Compiled node_modules/phoenix_html/priv/static/phoenix_html.js +2ms
brunch:modules Not wrapping (is vendor file) node_modules/phoenix/priv/static/phoenix.js +181ms
brunch:list Compiled node_modules/phoenix/priv/static/phoenix.js +7ms
brunch:write Writing 2/2 files +79ms
brunch:generate Concatenating [node_modules/phoenix/priv/static/phoenix.js, node_modules/phoenix_html/priv/static/phoenix_html.js, web/static/js/app.js, web/static/js/socket.js] => priv/static/js/app.js +27ms
brunch:generate Concatenating [web/static/css/app.css] => priv/static/css/app.css +50ms
brunch:generate Writing priv/static/js/app.js +11ms
brunch:generate Writing priv/static/css/app.css +1ms
brunch:generate Writing priv/static/js/app.js.map +9ms
brunch:generate Writing priv/static/css/app.css.map +10ms
19 Apr 19:08:45 - info: compiled 5 files into 2 files, copied 3 in 1.8 sec
brunch:watch change web/static/js/socket.js +46s
brunch:list Reading web/static/js/socket.js +0ms
brunch:pipeline Compiling web/static/js/socket.js @ BabelCompiler +1ms
brunch:pipeline Compiling web/static/js/socket.js @ JavaScriptCompiler +3ms
brunch:modules Wrapping web/static/js/socket.js @ commonjs +10ms
brunch:file Generated source map for 'web/static/js/socket.js' +4ms
brunch:list Compiled web/static/js/socket.js +0ms
brunch:write Writing 1/2 files +67ms
brunch:file Disposing node_modules/phoenix/priv/static/phoenix.js +0ms
brunch:generate Concatenating [node_modules/phoenix/priv/static/phoenix.js, node_modules/phoenix_html/priv/static/phoenix_html.js, web/static/js/app.js, web/static/js/socket.js] => priv/static/js/app.js +1ms
brunch:generate Writing priv/static/js/app.js +8ms
brunch:generate Writing priv/static/js/app.js.map +54ms
19 Apr 19:09:32 - info: compiled socket.js and 3 cached files into app.js in 155ms
brunch:watch change web/static/js/socket.js +26s
brunch:list Reading web/static/js/socket.js +0ms
brunch:pipeline Compiling web/static/js/socket.js @ BabelCompiler +2ms
brunch:pipeline Compiling web/static/js/socket.js @ JavaScriptCompiler +3ms
brunch:modules Wrapping web/static/js/socket.js @ commonjs +2ms
brunch:file Generated source map for 'web/static/js/socket.js' +0ms
brunch:list Compiled web/static/js/socket.js +0ms
brunch:write Writing 1/2 files +67ms
brunch:generate Concatenating [node_modules/phoenix_html/priv/static/phoenix_html.js, web/static/js/app.js, web/static/js/socket.js] => priv/static/js/app.js +0ms
brunch:generate Writing priv/static/js/app.js +3ms
brunch:generate Writing priv/static/js/app.js.map +33ms
19 Apr 19:09:58 - info: compiled socket.js and 2 cached files into app.js in 118ms
brunch:watch change web/static/js/socket.js +16s
brunch:list Reading web/static/js/socket.js +0ms
brunch:pipeline Compiling web/static/js/socket.js @ BabelCompiler +1ms
brunch:pipeline Compiling web/static/js/socket.js @ JavaScriptCompiler +17ms
brunch:modules Wrapping web/static/js/socket.js @ commonjs +1ms
brunch:file Generated source map for 'web/static/js/socket.js' +0ms
brunch:list Compiled web/static/js/socket.js +0ms
brunch:write Writing 1/2 files +67ms
brunch:generate Concatenating [node_modules/phoenix_html/priv/static/phoenix_html.js, web/static/js/app.js, web/static/js/socket.js] => priv/static/js/app.js +0ms
brunch:generate Writing priv/static/js/app.js +2ms
brunch:generate Writing priv/static/js/app.js.map +23ms
19 Apr 19:10:14 - info: compiled socket.js and 2 cached files into app.js in 129ms
- I changed
test.js
and thensocket.js
:
$ node_modules/brunch/bin/brunch watch -d
brunch:speed Created BrunchWatcher 250ms +0ms
brunch:application Trying to load brunch-config +3ms
brunch:speed Loaded config 274ms +20ms
brunch:speed Loading plugins 274ms +0ms
brunch:speed Loaded plugin babel-brunch 498ms +224ms
brunch:speed Loaded plugin clean-css-brunch 574ms +76ms
brunch:speed Loaded plugin css-brunch 575ms +1ms
brunch:speed Loaded plugin javascript-brunch 607ms +32ms
brunch:speed Loaded plugin uglify-js-brunch 683ms +76ms
brunch:plugins Loaded plugins: babel-brunch, css-brunch, javascript-brunch +2ms
brunch:speed Loaded plugins 685ms +0ms
brunch:speed Loaded watcher 686ms +1ms
brunch:watch add package.json +23ms
brunch:watch add brunch-config.js +9ms
brunch:watch add /home/czi/Elixir/brunchdemo/brunchdemo/node_modules/phoenix/priv/static/phoenix.js +1ms
brunch:list Reading node_modules/phoenix/priv/static/phoenix.js +1ms
brunch:speed Starting compilation 720ms +0ms
brunch:watch add /home/czi/Elixir/brunchdemo/brunchdemo/node_modules/phoenix_html/priv/static/phoenix_html.js +0ms
brunch:list Reading node_modules/phoenix_html/priv/static/phoenix_html.js +1ms
brunch:file Init node_modules/phoenix/priv/static/phoenix.js: isntModule=true isWrapped=true +4ms
brunch:file Init node_modules/phoenix_html/priv/static/phoenix_html.js: isntModule=true isWrapped=true +4ms
brunch:modules Not wrapping (is vendor file) node_modules/phoenix/priv/static/phoenix +4ms
brunch:list Compiled node_modules/phoenix/priv/static/phoenix.js +7ms
brunch:modules Not wrapping (is vendor file) node_modules/phoenix_html/priv/static/phoenix_html +0ms
brunch:list Compiled node_modules/phoenix_html/priv/static/phoenix_html.js +0ms
brunch:watch add web/static/assets/favicon.ico +10ms
brunch:asset Init web/static/assets/favicon.ico directory=web/static/assets/ relativePath=favicon.ico destinationPath=priv/static/favicon.ico +2ms
brunch:watch add web/static/assets/robots.txt +1ms
brunch:asset Init web/static/assets/robots.txt directory=web/static/assets/ relativePath=robots.txt destinationPath=priv/static/robots.txt +1ms
brunch:watch add web/static/css/app.css +1ms
brunch:list Reading web/static/css/app.css +0ms
brunch:watch add web/static/js/app.js +0ms
brunch:list Reading web/static/js/app.js +0ms
brunch:watch add web/static/js/socket.js +1ms
brunch:list Reading web/static/js/socket.js +0ms
brunch:watch add web/static/js/test.js +10ms
brunch:list Reading web/static/js/test.js +0ms
brunch:asset Copied web/static/assets/favicon.ico +14ms
brunch:asset Copied web/static/assets/robots.txt +1ms
brunch:file Init web/static/css/app.css: isntModule=false isWrapped=false +0ms
brunch:pipeline Compiling web/static/css/app.css @ CSSCompiler +1ms
brunch:list Compiled web/static/css/app.css +1ms
brunch:file Init web/static/js/app.js: isntModule=false isWrapped=true +1ms
brunch:pipeline Compiling web/static/js/app.js @ BabelCompiler +0ms
brunch:pipeline Compiling web/static/js/app.js @ JavaScriptCompiler +165ms
brunch:modules Wrapping web/static/js/app @ commonjs +9ms
brunch:file Generated source map for 'web/static/js/app.js' +0ms
brunch:list Compiled web/static/js/app.js +6ms
brunch:file Init web/static/js/socket.js: isntModule=false isWrapped=true +0ms
brunch:pipeline Compiling web/static/js/socket.js @ BabelCompiler +1ms
brunch:pipeline Compiling web/static/js/socket.js @ JavaScriptCompiler +72ms
brunch:modules Wrapping web/static/js/socket @ commonjs +3ms
brunch:file Generated source map for 'web/static/js/socket.js' +1ms
brunch:list Compiled web/static/js/socket.js +3ms
brunch:file Init web/static/js/test.js: isntModule=false isWrapped=true +0ms
brunch:pipeline Compiling web/static/js/test.js @ BabelCompiler +0ms
brunch:pipeline Compiling web/static/js/test.js @ JavaScriptCompiler +3ms
brunch:modules Wrapping web/static/js/test @ commonjs +3ms
brunch:file Generated source map for 'web/static/js/test.js' +0ms
brunch:list Compiled web/static/js/test.js +1ms
brunch:watch add web/static/assets/images/phoenix.png +2ms
brunch:asset Init web/static/assets/images/phoenix.png directory=web/static/assets/ relativePath=images/phoenix.png destinationPath=priv/static/images/phoenix.png +0ms
brunch:speed Watcher is ready 1053ms +1ms
brunch:asset Copied web/static/assets/images/phoenix.png +26ms
brunch:write Writing 2/2 files +70ms
brunch:generate Concatenating [node_modules/phoenix/priv/static/phoenix.js, node_modules/phoenix_html/priv/static/phoenix_html.js, web/static/js/app.js, web/static/js/socket.js, web/static/js/test.js] => priv/static/js/app.js +9ms
brunch:common Writing priv/static/js/app.js +120ms
brunch:common Writing priv/static/js/app.js.map +25ms
brunch:generate Concatenating [web/static/css/app.css] => priv/static/css/app.css +16ms
brunch:common Writing priv/static/css/app.css +13ms
brunch:common Writing priv/static/css/app.css.map +5ms
19 Apr 12:51:11 - info: compiled 6 files into 2 files, copied 3 in 1.1 sec
brunch:watch change web/static/js/test.js +26s
brunch:list Reading web/static/js/test.js +3ms
brunch:pipeline Compiling web/static/js/test.js @ BabelCompiler +2ms
brunch:pipeline Compiling web/static/js/test.js @ JavaScriptCompiler +15ms
brunch:modules Wrapping web/static/js/test @ commonjs +1ms
brunch:file Generated source map for 'web/static/js/test.js' +0ms
brunch:list Compiled web/static/js/test.js +1ms
brunch:write Writing 1/2 files +66ms
brunch:generate Concatenating [node_modules/phoenix/priv/static/phoenix.js, node_modules/phoenix_html/priv/static/phoenix_html.js, web/static/js/app.js, web/static/js/socket.js, web/static/js/test.js] => priv/static/js/app.js +1ms
brunch:common Writing priv/static/js/app.js +23ms
brunch:common Writing priv/static/js/app.js.map +49ms
19 Apr 12:51:38 - info: compiled test.js and 4 cached files into app.js in 164ms
brunch:watch change web/static/js/test.js +11s
brunch:list Reading web/static/js/test.js +0ms
brunch:pipeline Compiling web/static/js/test.js @ BabelCompiler +1ms
brunch:pipeline Compiling web/static/js/test.js @ JavaScriptCompiler +15ms
brunch:modules Wrapping web/static/js/test @ commonjs +0ms
brunch:file Generated source map for 'web/static/js/test.js' +0ms
brunch:list Compiled web/static/js/test.js +1ms
brunch:write Writing 1/2 files +66ms
brunch:generate Concatenating [node_modules/phoenix/priv/static/phoenix.js, node_modules/phoenix_html/priv/static/phoenix_html.js, web/static/js/app.js, web/static/js/socket.js, web/static/js/test.js] => priv/static/js/app.js +1ms
brunch:common Writing priv/static/js/app.js +13ms
brunch:common Writing priv/static/js/app.js.map +61ms
19 Apr 12:51:49 - info: compiled test.js and 4 cached files into app.js in 161ms
brunch:watch change web/static/js/socket.js +17s
brunch:list Reading web/static/js/socket.js +0ms
brunch:pipeline Compiling web/static/js/socket.js @ BabelCompiler +5ms
brunch:pipeline Compiling web/static/js/socket.js @ JavaScriptCompiler +53ms
brunch:modules Wrapping web/static/js/socket @ commonjs +3ms
brunch:file Generated source map for 'web/static/js/socket.js' +1ms
brunch:list Compiled web/static/js/socket.js +2ms
brunch:write Writing 1/2 files +66ms
brunch:generate Concatenating [node_modules/phoenix/priv/static/phoenix.js, node_modules/phoenix_html/priv/static/phoenix_html.js, web/static/js/app.js, web/static/js/socket.js, web/static/js/test.js] => priv/static/js/app.js +2ms
brunch:common Writing priv/static/js/app.js +7ms
brunch:common Writing priv/static/js/app.js.map +31ms
19 Apr 12:52:07 - info: compiled socket.js and 4 cached files into app.js in 182ms
brunch:watch change web/static/js/socket.js +8s
brunch:list Reading web/static/js/socket.js +2ms
brunch:pipeline Compiling web/static/js/socket.js @ BabelCompiler +1ms
brunch:pipeline Compiling web/static/js/socket.js @ JavaScriptCompiler +14ms
brunch:modules Wrapping web/static/js/socket @ commonjs +1ms
brunch:file Generated source map for 'web/static/js/socket.js' +0ms
brunch:list Compiled web/static/js/socket.js +0ms
brunch:write Writing 1/2 files +66ms
brunch:generate Concatenating [node_modules/phoenix/priv/static/phoenix.js, node_modules/phoenix_html/priv/static/phoenix_html.js, web/static/js/app.js, web/static/js/socket.js, web/static/js/test.js] => priv/static/js/app.js +2ms
brunch:common Writing priv/static/js/app.js +8ms
brunch:common Writing priv/static/js/app.js.map +33ms
19 Apr 12:52:15 - info: compiled socket.js and 4 cached files into app.js in 153ms
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
elm-brunch watch is missing some of my Elm file changes
Frequently, when I change an Elm file in my project, the compilation will appear to run, but the result will show elm compiler...
Read more >Wi-fi adapter disappeared after installing Brunch
I installed Brunch with Live USB Linux Mint. After the first download in Chromeos, I did not work Wi-Fi. I thought that this...
Read more >What Causes a File to Suddenly Disappear?
Disappearing files may be corrupted, hidden, infected or moved.
Read more >Editing existing files that disappear.
1) Right click Start button to open Task Manager, show More Details, then choose Processes tab, scroll down to Windows Processes, then further ......
Read more >Family files missing persons report for rapper Theophilus ...
How likely do you think it is, if at all, that the Dept. of Justice will opt to pursue criminal charges against former...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I added
to the Brunch config, as I read in another issue, and it seems it helped.
Had a similar problem using WebStorm and
brunch watch
. To fix it I did not have to use thewatcher
block in the Brunch configuration. Instead I went to File > Settings > Appearance & Behavior > System Settings and unchecked option ‘Use “safe write” (save changes to a temporary file first)’.