Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Module build failed: TypeError: text.forEach is not a function #131

Closed
Oleksandr-Silin opened this issue Nov 26, 2015 · 7 comments
Closed

Comments

@Oleksandr-Silin
Copy link

I have webpack config

    module: {
        loaders: [
            ...
            {
                test: /\.css$/,
                loader: ExtractTextPlugin.extract("style-loader", "css-loader")
            },
            ...
        ]
    },
    plugins: [
        ...
        new ExtractTextPlugin("[name].css", {
            disable: false,
            allChunks: true
        })
    ]

and app.js file:

var React = require('react');
require('../css/colors.css');
require('../css/main.css');
require('../css/tags.css');
Router.run(function (Handler, state) {
    React.render(<Handler/>, document.getElementById('my-app'));
});

with such configuration i receive error for each css file in console output:
Module build failed: TypeError: text.forEach is not a function
at Object. (/home/src/app/node_modules/extract-text-webpack-plugin/loader.js:100:11)
at Compiler. (/home/src/app/node_modules/webpack/lib/Compiler.js:214:10)
at /home/src/app/node_modules/webpack/lib/Compiler.js:403:12....

If I remove configuration, styles are inlined into head of html file.

{
 disable: false,
 allChunks: true
}

How should i update or fix it?

@sheerun
Copy link

sheerun commented Nov 29, 2015

I have the same issue

@GreenGremlin
Copy link

Adding css-loader to the ignore option fixed this, for me.

    new SplitByPathPlugin(
      [{ name: 'vendor', path: __dirname + '/node_modules' }],
      { ignore: [__dirname + '/node_modules/css-loader'] }
    ),

@Oleksandr-Silin
Copy link
Author

@GreenGremlin Thank you! It helped me.

@nadavsinai
Copy link

thanks @GreenGremlin !

@anton-rodin
Copy link

Thank you! @GreenGremlin

@jknight12882
Copy link

I am getting this issue and am not using the SplitByPathPlugin. This is with Webpack@3.x.x

@sresant
Copy link
Contributor

sresant commented Sep 5, 2017

I am in the same boat as @jknight12882. Seems to be under watch mode specifically. I added some logging to see what the text object is and it is a function.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants