Giter Club home page Giter Club logo

Comments (5)

IngwiePhoenix avatar IngwiePhoenix commented on June 11, 2024 1

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 [email protected]:

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. (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. (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 #18.

from imports-loader.

wzup avatar wzup commented on June 11, 2024

@IngwiePhoenix are you sure? Then how about this answer? #17 (comment)

try loader: ['imports-loader?angular'], instead of loaders: ['imports-loader?angular'],

from imports-loader.

wzup avatar wzup commented on June 11, 2024

@IngwiePhoenix and actually you're right. It works if loader: String. So that guy was wrong, he gave wrong answer and I followed that.

from imports-loader.

IngwiePhoenix avatar IngwiePhoenix commented on June 11, 2024

Array does not have a split method, but String does. When using "loader:", WebPack expects a string and uses .split() on it with an exclamation point as the deliminator to extract loaders. Basically, you could imagine it this way:

var loaders = loaderList[matchedIndex].split("!")

from imports-loader.

SpaceK33z avatar SpaceK33z commented on June 11, 2024

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

from imports-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.