我正在运行以下行来获取项目的分散路由配置
require.context('../../../..', true,
/^.*\/resources\/assets\/js\/plugin\.routes\.js$/).keys()
webpack似乎成功编译,在构建期间吐出以下行后,说“构建成功”
10% building modules 0/1 modules 1 active ...ces\/assets\/js\/plugin\.routes\.js$/
记录require.context
的输出成功,提供["./acorn_coursemanagement/resources/assets/js/plugin.routes.js"]
。目前项目中只有一个路径文件,这正在按预期工作。
然而,webpack在说“构建成功”
后立即启动以下过程WAIT Compiling... 13:06:07
10% building modules 0/1 modules 1 active ...ces\/assets\/js\/plugin\.routes\.js$/
挂起约2分钟后,webpack进程会发出以下信息
<--- Last few GCs --->
[4712:0x102801e00] 222922 ms: Mark-sweep 1242.9 (1494.6) -> 1242.7 (1496.1) MB, 1928.8 / 1.6 ms allocation failure GC in old space requested
[4712:0x102801e00] 224801 ms: Mark-sweep 1242.7 (1496.1) -> 1242.7 (1450.6) MB, 1878.7 / 1.9 ms last resort GC in old space requested
[4712:0x102801e00] 226709 ms: Mark-sweep 1242.7 (1450.6) -> 1242.7 (1446.1) MB, 1907.9 / 1.7 ms last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x3639fc25739 <JSObject>
1: set(this=0x3632dda7401 <Map map = 0x3630c7048d9>,0x363aa0f39e1 <String[126]: /Users/xxxxx/code/pursuit/acorn-seed/local/acorn_shared/node_modules/fsevents/node_modules/verror/tests/tst.inherit.js>,0x3631fc76051 <JSArray[1]>)
2: /* anonymous */(aka /* anonymous */) [/Users/xxxxx/code/pursuit/acorn-seed/local/acorn_shared/node_modules/webpack/lib/ContextModuleFactory.js:~...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/Users/xxxxx/.nvm/versions/node/v9.3.0/bin/node]
2: node::OnFatalError(char const*, char const*) [/Users/xxxxx/.nvm/versions/node/v9.3.0/bin/node]
3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/xxxxx/.nvm/versions/node/v9.3.0/bin/node]
4: v8::internal::Factory::NewFixedArray(int, v8::internal::PretenureFlag) [/Users/xxxxx/.nvm/versions/node/v9.3.0/bin/node]
5: v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Rehash(v8::internal::Handle<v8::internal::OrderedHashMap>, int) [/Users/xxxxx/.nvm/versions/node/v9.3.0/bin/node]
6: v8::internal::Runtime_MapGrow(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/xxxxx/.nvm/versions/node/v9.3.0/bin/node]
7: 0x8361ce042fd
8: 0x8361ceb251e
并且进程崩溃。
我在较小的项目中运行类似的过程,并且构建成功。对于上下文,项目中有820551个文件正在崩溃。
我想知道为什么构建成功运行,如成功的日志和webpack通知'Build Successful'所示,然后立即重新运行相同的进程并崩溃。
我认为这可能与在watch
模式下运行webpack有关,因为一次性构建成功运行,而手表似乎重新触发了失败的构建。