TypeError: element.loader.split is not a function

Hello, I ran into this issue when running webpack:

D:\__start\WorkOrderUI\node_modules\webpack\node_modules\webpack-core\li
b\LoadersList.js:58                                                     
        if(element.loader) return element.loader.split("!");            
                                                 ^                      

TypeError: element.loader.split is not a function                       
    at getLoadersFromObject (D:\__start\WorkOrderUI\node_modules\webpack
\node_modules\webpack-core\lib\LoadersList.js:58:43)                    
    at LoadersList.<anonymous> (D:\__start\WorkOrderUI\node_modules\webp
ack\node_modules\webpack-core\lib\LoadersList.js:78:12)                 
    at Array.map (native)                                               
    at LoadersList.match (D:\__start\WorkOrderUI\node_modules\webpack\no
de_modules\webpack-core\lib\LoadersList.js:70:19)                       
    at NormalModuleFactory.<anonymous> (D:\__start\WorkOrderUI\node_modu
les\webpack\lib\NormalModuleFactory.js:109:65)                          
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\async\li
b\async.js:697:13                                                       
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\async\li
b\async.js:52:16                                                        
    at done (D:\__start\WorkOrderUI\node_modules\webpack\node_modules\as
ync\lib\async.js:248:21)                                                
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\async\li
b\async.js:44:16                                                        
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\async\li
b\async.js:694:17                                                       
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\async\li
b\async.js:173:37                                                       
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\enhanced
-resolve\lib\UnsafeCachePlugin.js:29:4                                  
    at onResolved (D:\__start\WorkOrderUI\node_modules\webpack\node_modu
les\enhanced-resolve\lib\Resolver.js:39:10)                             
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\enhanced
-resolve\lib\Resolver.js:123:21                                         
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\enhanced
-resolve\lib\Resolver.js:191:15                                         
    at applyPluginsParallelBailResult.createInnerCallback.log (D:\__star
t\WorkOrderUI\node_modules\webpack\node_modules\enhanced-resolve\lib\Res
olver.js:104:30)                                                        
    at loggingCallbackWrapper (D:\__start\WorkOrderUI\node_modules\webpa
ck\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19)      
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\tapable\
lib\Tapable.js:134:6                                                    
    at innerCallback (D:\__start\WorkOrderUI\node_modules\webpack\node_m
odules\enhanced-resolve\lib\Resolver.js:90:37)                          
    at loggingCallbackWrapper (D:\__start\WorkOrderUI\node_modules\webpa
ck\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19)      
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\tapable\
lib\Tapable.js:134:6                                                    
    at Tapable.<anonymous> (D:\__start\WorkOrderUI\node_modules\webpack\
node_modules\enhanced-resolve\lib\DirectoryDescriptionFileFieldAliasPlug
in.js:101:26)                                                           
    at D:\__start\WorkOrderUI\node_modules\webpack\node_modules\enhanced
-resolve\lib\DirectoryDescriptionFileFieldAliasPlugin.js:52:26          
    at Storage.finished (D:\__start\WorkOrderUI\node_modules\webpack\nod
e_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16)          
    at FSReqWrap.readFileAfterClose [as oncomplete] (evalmachine.<anonym
ous>:380:3)

Here’s my node modules:

├── babel-core@5.8.25
├── babel-loader@5.3.2
├── file-loader@0.8.4
├── react@0.13.3
├── react-bootstrap@0.25.2
├── react-hot-loader@1.3.0
├── react-router@1.0.0-rc1
├── react-router-bootstrap@0.19.0
├── reactable@0.11.4
├── webpack@1.12.2
└── webpack-dev-server@1.11.0

Thanks.

Author: Fantashit

5 thoughts on “TypeError: element.loader.split is not a function

  1. at done (/Users/add/Documents/hank/TestProject/lawer-bogon:lawer-vue hank$ webpack --watch
    

    /Users/add/Documents/hank/TestProject/lawer-vue/node_modules/webpack-core/lib/LoadersList.js:58
    if(element.loader) return element.loader.split(“!”);
    ^

    TypeError: element.loader.split is not a function
    at getLoadersFromObject (/Users/add/Documents/hank/TestProject/lawer-vue/node_modules/webpack-core/lib/LoadersList.js:58:43)
    at LoadersList. (/Users/add/Documents/hank/TestProject/lawer-vue/node_modules/webpack-core/lib/LoadersList.js:78:12)
    at Array.map (native)
    at LoadersList.match (/Users/add/Documents/hank/TestProject/lawer-vue/node_modules/webpack-core/lib/LoadersList.js:70:19)
    at /Users/add/Documents/hank/TestProject/lawer-vue/node_modules/webpack/lib/NormalModuleFactory.js:111:68
    at /Users/add/Documents/hank/TestProject/lawer-vue/node_modules/async/lib/async.js:726:13
    at /Users/add/Documents/hank/TestProject/lawer-vue/node_modules/async/lib/async.js:52:16
    at done (/Users/add/Documents/hank/TestProject/lawer-bogon:lawer-vue hank$

  2. @sokra

    Change loader to loaders if you pass an array.

    Then why didn’t you name the error that way?
    element.loader.split is not a function vs. Change loader to loaders if you pass an array
    Oh, they soooo absolutely the same. Simply twins

Comments are closed.