Skip to content
This repository was archived by the owner on Aug 20, 2018. It is now read-only.
This repository was archived by the owner on Aug 20, 2018. It is now read-only.

TypeError: text.forEach is not a function #43

Closed
@HairyRabbit

Description

@HairyRabbit

Hi, I want to use json-loader with ExtractTextPlugin like this config:

rule: {
  test: /\.json$/,
  loader: ExtractJSON.extract({
    loader: [{
      loader: 'json-loader'
    }]
  })
}

That was throw this error:

ERROR in ./src/index.json
    Module build failed: TypeError: text.forEach is not a function
        at Object.<anonymous> (\node_modules\extract-text-webpack-plugin\loader.js:109:10)
        at Compiler.<anonymous> (\node_modules\webpack\lib\Compiler.js:280:10)
        at \node_modules\webpack\lib\Compiler.js:480:13
        ...

I change the json-loader return value as:

// json-loader/index.js

return "module.exports = " + '`' + JSON.stringify(value, undefined, "\t") + '`' + ";";

It's works fine, but I think it's not a good idea. Anything help for this problem ?

Thanks :)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions