webpack --watch가 변경된 파일을 컴파일하지 않습니다.
실행을 시도 webpack --watch하고 JS 파일을 편집 한 후 자동 재 컴파일을 트리거하지 않습니다.
다시 설치 webpack를 시도했지만 npm uninstall여전히 작동하지 않습니다.
어떤 아이디어?
참고 :이 OS X이 손상받을 폴더와 더 이상 보낼 수 있습니다 보인다 fsevents( watchpack/ chokidar자체 / 파인더 사용) 및 하위 폴더를. 이것이 당신에게 일어난 일인지 확신 할 수는 없지만 저와 동료에게는 매우 실망 스러웠습니다.
손상된 상위 폴더의 이름을 바꿀 수 있었고 예상대로 이벤트가 즉시 발생하는 것을 볼 수있었습니다. 자세한 내용은이 블로그 게시물을 참조하십시오. http://feedback.livereload.com/knowledgebase/articles/86239-os-x-fsevents-bug-may-prevent-monitoring-of-certai
위 링크에서 권장하는 수정 사항은 다음과 같습니다.
- 컴퓨터 재부팅
- 디스크 유틸리티를 통해 디스크 확인 및 권한 복구
- Spotlight 개인 정보 목록 (인덱싱하지 않을 폴더 목록)에 폴더를 추가 한 다음 제거하여 효과적으로 재 인덱싱
- 폴더 이름을 바꾼 다음 다시 이름 바꾸기
- 폴더를 다시 만들고 이전 내용을 다시 폴더로 이동
처음 두 가지는 우리에게 효과가 없었고 Spotlight 제안을 시도하지 않았으며 재현이 필요하다는 것이 입증되지 않았습니다.
우리는 Finder를 열고 즉시 나타날 때까지 각각의 연속적인 상위 폴더에 파일을 생성하여 루트 문제 폴더를 찾을 수있었습니다 (Finder가이 버그로 인해 망가질 것이기 때문입니다). 업데이트되지 않는 가장 루트 폴더가 범인입니다. 우리는 mv그것을 mv원래 이름으로 되돌려 놓은 다음 감시자가 일했습니다.
부패의 원인이 무엇인지는 모르겠지만 문제를 해결하게되어 기쁩니다.
코드가 다시 컴파일되지 않으면 감시자 수를 늘리십시오 (Ubuntu에서).
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
출처 : https://webpack.github.io/docs/troubleshooting.html
내 웹팩 구성 파일에 다음 코드를 추가하면 문제가 해결되었으므로 도움이되기를 바랍니다. HMR (핫 모듈 교체)의 성능을 저하 시키므로 node_modules 폴더를 무시하는 것을 잊지 마십시오.
watchOptions: {
poll: true,
ignored: /node_modules/
}
WebStorm으로 작업 할 때이 문제가 발생했습니다.
설정-> 시스템 설정-> "안전 쓰기"를 비활성화 하면 문제가 해결되었습니다.
권장 사항은 WebPack 문제 해결 에서 찾았습니다.
가능한 해결책을 추가하기 위해 : Dropbox 폴더 안에 프로젝트 폴더가 있었는데,이 폴더를 옮기면 문제가 해결되었습니다. (OS X)
한 가지 문제는 경로 이름이 절대적이지 않으면 이와 같은 일이 발생한다는 것입니다. 실수로 설정 한 resolve.root에 ./대신 __dirname이 시간의 삭제 나 위의 사람처럼 다시 만드는 많은 파일을 낭비 나 발생했습니다.
César가 지적한대로 fs.inotify.max_user_watches를 변경해도 여전히 작동하지 않는 경우 문서에 표시된대로 스크립트를 작성 하거나 --watch --watch-poll옵션 과 함께 웹팩을 실행 하여 기본 감시자 대신 폴링을 사용하십시오 .
업데이트 : 전체 디렉토리를 삭제하고 저장소에서 새로 복제하면 문제가 해결됩니다.
Vim을 사용하는 경우 기본 자동이 아닌 backupcopy를 yes로 설정해야합니다. 그렇지 않으면 Vim은 때때로 원본 파일의 이름을 바꾸고 새 파일을 생성하여 webpack watch를 망칠 것입니다.
https://github.com/webpack/webpack/issues/781
이 경우 vim 설정에 다음을 추가하십시오.
backupcopy = yes 설정
가상 머신 (Vagrant / Virtualbox)에서 웹팩을 실행하고 호스트 플랫폼에서 파일을 변경하는 경우 공유 폴더의 파일 업데이트가 Ubuntu에서 inotify를 트리거하지 않을 수 있습니다. 그러면 변경 사항이 webpack에서 선택되지 않습니다.
제 경우에는 de guest (vi)에서 파일을 편집하고 저장하면 webpack이 트리거되었습니다. 호스트 (PhpStorm, 메모장 또는 기타 응용 프로그램)에서 편집하면 내가 한 일이 웹팩을 트리거하지 않습니다.
vagrant-fsnotify 를 사용하여 해결했습니다 .
폴더 대소 문자 구분이 제 문제였습니다. require ()에 대한 내 코드 호출에는 모두 소문자 경로 이름이 있지만 실제로 디렉토리에는 대문자가 있습니다. 내 모든 디렉토리의 이름을 소문자로 변경하고 웹팩 시청이 즉시 작동했습니다.
I was having the same issue on a .vue file. When the server restarted all worked fine, but on the next save it didn't recompiled anymore. The issue was on the import file path that had one letter capitalized. It's very hard to figure this issue because everything works on a server reboot. Check the case of your paths.
It wasn't recompiling for me but then I realized / remembered that webpack watches the dependency graph and not just a folder (or files). Sure enough the files I was changing weren't part of that graph yet.
Work for me in Laravel Homestead
--watch --watch-poll
For me, creating folders and files in VS Code was the issue. To fix, I re-cloned my repo and this time, created new folders and files through the command line instead of Code. I think Code was corrupting the files for some reason. I saw the application just updated so maybe it's a new bug.
The way I resolved the issue was finding a capitalization error in an import path. Folder on file system had lower case first letter, import path was upper case. Everything compiled fine, so this was just a webpack watch include issue.
I have the same issue. And I notice it's not compiling because my folder contains some character(*). And using the old watcher plugin seems to resolve the issue. Add this line to your webpack config file.
plugins: [
new webpack.OldWatchingPlugin()
]
I had similar issue, neither webpack or rollup in watch mode ware catching the changes I made. I found out that it was basically my fault as I was changing module (.tsx file) which wasn't yet imported anywhere in the application (for example App.ts which is entry point) and I was expecting build tools to report errors I made there.
For me deleting node_modules and doing npm install or yarn again to install all the packages solved the problem
Also had this issue inside a VirtualBox (5.2.18) Ubuntu (18.04) VM using Vagrant (2.1.15) with rsync synchronization. Suddenly, first build runs great but Webpack does not take the changes into consideration afterwards, even with fs.inotify.max_user_watches=524288 set. Adding poll: true in Webpack config didn't help either.
Only vagrant-notify-forwarder worked (vagrant-fsnotify didn't, for some reason), but then the rebuild happened too quickly after saving the file on the host and I suppose that rsync didn't have enough time to finish its task (maybe due to the amount of synced directories inside my Vagrantfile?).
Finally I made the watch work again by also increasing the aggregateTimeout in my Webpack config:
module.exports = {
watch: true,
watchOptions: {
aggregateTimeout: 10000
},
...
}
If this solution works for you, try lowering this value again, otherwise you'll have to wait 10 seconds until the build restarts each time you hit save. The default value is 300 ms.
An easy solution on MacOS is the following :
Open two terminal windows in the same directory that your project resides.
In the first terminal window run : webpack --watch
In the second terminal windows run : webpack-dev-server
I have tried many possible solutions and this seems to be the most reliable
Possible solution: changing context to the app directory.
I had all my webpack config files in a sub folder:
components/
webpack/
development.js
app.js
In webpack/development.js, set context: path.join(__dirname, '../') solved my problem.
After trying a handful of strategies for fixing this problem I ended up just giving up but then while solving another issue I tried again and all of sudden the --watch flag was finally working.
To be honest I do not know what specifically made it work but after performing the following steps it just started working:
1. Install most recent gcc version
$ sudo port install gcc48
$ sudo port select --set gcc mp-gcc48
2. Install most recent clang version
$ sudo port install clang-3.6
$ sudo port select --set clang mp-clang-3.6
3. Export variables holding the patch to C and C++ compiler
$ export CC=/opt/local/bin/clang
$ export CXX=/opt/local/bin/clang++
It might have happened that while installing these packages some dependency just added the missing piece of the puzzle, who knows ...
Hope this help anyone struggling out there to make it working.
I am adding another answer because I believe that this is the best solution so far. I am using it every day and it rocks! Just install this library :
https://github.com/gajus/write-file-webpack-plugin
Description : Forces webpack-dev-server program to write bundle files to the file system.
How to install :
npm install write-file-webpack-plugin --save-dev
Try changing --watch to -d --watch
worked for me
If this happened suddenly in your project, then this could fix the issue.
Maybe somehow the files which were tracking your project changes which webpack looks for got corrupted. You can create them again just by following simple steps.
- come out of your project dir. ($: cd ..)
- move your project to different directory ($: mv {projectName} {newName})
- go into the new dir ($: cd {newName})
- start the server and check if it reloads on every file change (it should work in most cases, because now webpack creates new files to watch for changes)
- come out of the dir ($: cd ..)
- move it back to its original name ($: mv {newName} {projectNam}) This worked for me............
I came across this question when I was having a similar issue-- it appeared that webpack was not rebundling, even when running webpack --config.
I even deleted bundle.js and the webpage was still displaying as before my edits.
For those of you who get this same problem, I finally did the 'empty cache and hard reload' option in chrome (right click the reload button with the devtools open) and that did that trick
The thing is: webpack loads script from some weird url: webpack:/// which is cached. You should add version at the end of your script to prevent caching: main-compiled.js?v=<?php echo time()?>"
참고URL : https://stackoverflow.com/questions/26708205/webpack-watch-isnt-compiling-changed-files
'developer tip' 카테고리의 다른 글
| 파일 시스템에서 클래스를 이동 한 후 "XXX 클래스는 유효한 엔티티 또는 매핑 된 수퍼 클래스가 아닙니다." (0) | 2020.09.20 |
|---|---|
| 내부 서버 오류-htaccess (0) | 2020.09.20 |
| VS2012가 일반 TFS 체크인 창으로 돌아 갑니까? (0) | 2020.09.19 |
| React JS-Uncaught TypeError : this.props.data.map은 함수가 아닙니다. (0) | 2020.09.19 |
| 사용자 권한을 처음 부여 할 때 왜“GRANT USAGE”가 생성됩니까? (0) | 2020.09.19 |