question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: element.loader.split is not a function

See original GitHub issue

This throws an error:

        }, {
            test: require.resolve("jquery"),
            loader: ["imports?$=jquery,jQuery=jquery"]
        }],

This error:

$ webpack --config webpack.development.config.js -cd --progress --watch
 20% 1/6 build modulesc:\Users\user\app\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 (c:\Users\user\app\node_modules\webpack-core\lib\LoadersList.js:58:43)
    at LoadersList.<anonymous> (c:\Users\user\app\node_modules\webpack-core\lib\LoadersList.js:78:12)
    at Array.map (native)
    at LoadersList.match (c:\Users\user\app\node_modules\webpack-core\lib\LoadersList.js:70:19)
    at c:\Users\user\app\node_modules\webpack\lib\NormalModuleFactory.js:111:68
    at c:\Users\user\app\node_modules\async\lib\async.js:726:13
    at c:\Users\user\app\node_modules\async\lib\async.js:52:16
    at done (c:\Users\user\app\node_modules\async\lib\async.js:246:17)
    at c:\Users\user\app\node_modules\async\lib\async.js:44:16
    at c:\Users\user\app\node_modules\async\lib\async.js:723:17
    at c:\Users\user\app\node_modules\async\lib\async.js:167:37
    at c:\Users\user\app\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:29:4
    at onResolved (c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:39:10)
    at innerCallback (c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:89:22)
    at loggingCallbackWrapper (c:\Users\user\app\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19)
    at c:\Users\user\app\node_modules\tapable\lib\Tapable.js:134:6
    at c:\Users\user\app\node_modules\enhanced-resolve\lib\ModulesInDirectoriesPlugin.js:55:11
    at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:191:15
    at c:\Users\user\app\node_modules\enhanced-resolve\lib\ModulesInDirectoriesPlugin.js:46:14
    at loggingCallbackWrapper (c:\Users\user\app\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19)
    at c:\Users\user\app\node_modules\tapable\lib\Tapable.js:134:6
    at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:123:21
    at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:191:15
    at applyPluginsParallelBailResult.createInnerCallback.log (c:\Users\user\app\node_modules\enhanced-resolve\lib\Resol
s:104:30)
    at loggingCallbackWrapper (c:\Users\user\app\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19)
    at c:\Users\user\app\node_modules\tapable\lib\Tapable.js:134:6
    at Tapable.<anonymous> (c:\Users\user\app\node_modules\enhanced-resolve\lib\DirectoryDescriptionFilePlugin.js:68:32)
    at loggingCallbackWrapper (c:\Users\user\app\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19)
    at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:123:21
    at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:191:15

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
IngwiePhoenixcommented, Feb 14, 2016

When you use the key “loader”, only a string is expected. Use “loaders” if you want ot pass an array.

Am 14.02.2016 um 04:46 schrieb wzup notifications@github.com:

This throws an error:

    }, {
        test: require.resolve("jquery"),
        loader: ["imports?$=jquery,jQuery=jquery"]
    }],

This error:

$ webpack --config webpack.development.config.js -cd --progress --watch 20% 1/6 build modulesc:\Users\user\app\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 (c:\Users\user\app\node_modules\webpack-core\lib\LoadersList.js:58:43) at LoadersList.<anonymous> (c:\Users\user\app\node_modules\webpack-core\lib\LoadersList.js:78:12) at Array.map (native) at LoadersList.match (c:\Users\user\app\node_modules\webpack-core\lib\LoadersList.js:70:19) at c:\Users\user\app\node_modules\webpack\lib\NormalModuleFactory.js:111:68 at c:\Users\user\app\node_modules\async\lib\async.js:726:13 at c:\Users\user\app\node_modules\async\lib\async.js:52:16 at done (c:\Users\user\app\node_modules\async\lib\async.js:246:17) at c:\Users\user\app\node_modules\async\lib\async.js:44:16 at c:\Users\user\app\node_modules\async\lib\async.js:723:17 at c:\Users\user\app\node_modules\async\lib\async.js:167:37 at c:\Users\user\app\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:29:4 at onResolved (c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:39:10) at innerCallback (c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:89:22) at loggingCallbackWrapper (c:\Users\user\app\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19) at c:\Users\user\app\node_modules\tapable\lib\Tapable.js:134:6 at c:\Users\user\app\node_modules\enhanced-resolve\lib\ModulesInDirectoriesPlugin.js:55:11 at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:191:15 at c:\Users\user\app\node_modules\enhanced-resolve\lib\ModulesInDirectoriesPlugin.js:46:14 at loggingCallbackWrapper (c:\Users\user\app\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19) at c:\Users\user\app\node_modules\tapable\lib\Tapable.js:134:6 at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:123:21 at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:191:15 at applyPluginsParallelBailResult.createInnerCallback.log (c:\Users\user\app\node_modules\enhanced-resolve\lib\Resol s:104:30) at loggingCallbackWrapper (c:\Users\user\app\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19) at c:\Users\user\app\node_modules\tapable\lib\Tapable.js:134:6 at Tapable.<anonymous> (c:\Users\user\app\node_modules\enhanced-resolve\lib\DirectoryDescriptionFilePlugin.js:68:32) at loggingCallbackWrapper (c:\Users\user\app\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19) at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:123:21 at c:\Users\user\app\node_modules\enhanced-resolve\lib\Resolver.js:191:15 — Reply to this email directly or view it on GitHub https://github.com/webpack/imports-loader/issues/18.

0reactions
SpaceK33zcommented, Oct 9, 2016

Closing since this is a user error. In webpack v2 you’ll get a very clear error message for an error like this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

element.loader.split is not a function - webpack - Stack Overflow
The problem is in your last loader. {test: /\.(jpe?g|png|gif|svg)$/i, loader: [ 'file?hash=sha512&digest=hex&name=[hash].
Read more >
TypeError: element.loader.split is not a function #1465 - GitHub
Hello, I ran into this issue when running webpack: D:\__start\WorkOrderUI\node_modules\webpack\node_modules\webpack-core\li ...
Read more >
TypeError: element.loader.split is not a function - Treehouse
"TypeError: element.loader.split is not a function". When I run my webpack-dev-server, I get the following error message in the console:.
Read more >
element.loader.split is not a function-babel.js - appsloveworld
Coding example for the question Run webpack error information: element.loader.split is not a function-babel.js.
Read more >
TypeError: split is not a function in JavaScript - Java2Blog
TypeError : .split is not a function occurs when we call split() function on object which is not an string. split() function can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found