-
Notifications
You must be signed in to change notification settings - Fork 0
troubleshooting.cn
-
--display-error-details
give you more details. -
Read Configuration regarding resolving starting at
resolve
-
loaders have their own resolving configuration
resolveLoader
-
--display-error-details
能提供更详细信息 -
阅读Configuration关于解析的
resolve
部分 -
加载器拥有它们自己的解析配置
resolveLoader
The node.js module resolving algorithm is pretty simple: module dependencies are looked up in node_modules
folders in every parent directory of the requiring module. When you npm link
modules with peer dependencies that are not in your root directory, modules can no longer be found. (You probably want to consider peerDependencies
with npm link
as broken by design in node.js.) Note that a dependency to the application (even if this is not the perfect design) is also a kind of peerDependency even if it's not listed as such in the module's package.json
.
node.js的模块解析算法非常简单:模块的依赖会在引用到的模块的每一层父级目录的node_modules
目录下寻找。当拥有peer dependencies的npm link
模块不在你的根目录,模块不再被找到。(你可能需要考虑使用peerDependencies
,基于npm link
在node中的设计缺陷。)请注意,应用的依赖(即使不是完美的设计)也是一种peerDependency,即使那些模块的package.json
中没有列出。[后半段不知所云]
But you can easily workaround that in webpack: Add the node_modules
folder of your application to the resolve paths. There are two config options for this: resolve.fallback
and resolveLoader.fallback
.
但你可以在webpack中轻松解决:添加应用的node_modules
目录以用来解析路径。有两个对应配置选项:resolve.fallback
和 resolveLoader.fallback
Here is a config example:
下面是一个配置的样例:
module.exports = {
resolve: { fallback: path.join(__dirname, "node_modules") },
resolveLoader: { fallback: path.join(__dirname, "node_modules") }
};
Verify that webpack is not being notified of changes by running with the --progress flag. If progress shows on save but no files are output, it is likely a configuration issue, not a file watching issue. 实时证明 webpack 使用 --progress 标记使用时,不会被通知文件变更。如果保存时进度出现,但没有输出文件,可能是配置问题,而不是文件监听问题。
webpack --watch --progress
Verify that if you have enough available watchers in your system. If this value is too low, the file watcher in Webpack won't recognize the changes:
验证系统是否有足够可用的监视器。如果这个值太低,webpack的文件监视器不会识别到源码变更:
cat /proc/sys/fs/inotify/max_user_watches
Arch users, add fs.inotify.max_user_watches=524288
to /etc/sysctl.d/99-sysctl.conf
and then execute sysctl --system
. Ubuntu users (and possibly others): echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
.
Arch系统的用户,添加 fs.inotify.max_user_watches=524288
到 /etc/sysctl.d/99-sysctl.conf
,然后执行sysctl --system
。Ubuntu系统的用户(其他可能的系统)请执行echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
.
On OS-X folders can get corrupted. See this article:
OS-X系统上面目录可能会崩溃。参见这篇文章:
OS X FSEvents bug may prevent monitoring of certain folders
webpack expects absolute paths for many config options. __dirname + "/app/folder"
is wrong, because windows uses \
as path separator. This breaks some stuff.
webpack的许多配置选项都需要绝对路径。__dirname + "/app/folder"
是错误用法,因为windows使用\
作为路径分隔符。这会破坏某些东西。
Use the correct separators. I.e. path.resolve(__dirname, "app/folder")
or path.join(__dirname, "app", "folder")
.
使用正确的分隔符。如path.resolve(__dirname, "app/folder")
或 path.join(__dirname, "app", "folder")
On some machines Vim is preconfigured with the backupcopy option set to auto. This could potentially cause problems with the system's file watching mechanism. Switching this option to yes
will make sure a copy of the file is made and the original one overwritten on save.
在一些机器上Vim是预配置了backupcopy option为auto。系统的文件监视机制的差异可能会导致问题。将选项切换成yes
会保证创建文件的副本,而原文件会在保存时被覆盖。
:set backupcopy=yes