Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having difficulty using react-widgets-webpack with extract-text-webpack-plugin #1

Open
peejaybee opened this issue Mar 7, 2017 · 2 comments

Comments

@peejaybee
Copy link

When I attempt to follow the instructions for using with extract-text-webpack-plugin and Webpack 2, I get the following error:

ERROR in ./~/react-widgets-webpack/index.loader.js!./react-widgets.config.js
Module build failed: Error: Breaking change: extract now only takes a single argument. Either an options object *or* the loader(s).
Example: if your old code looked like this:
    ExtractTextPlugin.extract('style-loader', 'css-loader')

You would change it to:
    ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })

Changing to

styleLoader: require('extract-text-webpack-plugin').extract({
        fallback: "style-loader",
        use: 'css-loader!less-loader'
    }),

gives the following error:

ERROR in ./~/react-widgets-webpack/index.loader.js!./react-widgets.config.js
Module not found: Error: Can't resolve '[object Object],[object Object],[object Object],[object Object]' in '/Users/pbirmingham/Development/FLA/forks/flash/flash'

My webpack.config.js:

const webpack = require('webpack');
const globalizePlugin = require('globalize-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
    entry: {
        app: [
            'react-widgets-webpack!./react-widgets.config.js',
            'bootstrap-loader',
            './js/main.js']
    },
    output: {
        path: './public/',
        filename: 'js/bundle-[hash].js',
    },
    module: {
        rules: [
            {test: /\.(js|jsx)$/, exclude: /node_modules/, use: 'babel-loader'},
            {test: /\.json$/, use: 'json-loader'},
            {
                test: /\.(css|scss)$/,
                use: ExtractTextPlugin.extract({
                    fallback: "style-loader",
                    use: ['css-loader', 'sass-loader']
                })
            },
            {
                test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
                use: "url-loader?name=[name].[hash].[ext]&limit=10000&mimetype=application/font-woff"
            },
            {test: /\.(ttf|eot|svg|gif)$/, use: "file-loader?name=[name].[hash].[ext]"},
            {test: /bootstrap.+\.(jsx|js)$/, use: 'imports-loader?jQuery=jquery,$=jquery,this=>window'}
        ]
    },
    plugins: [
        new ExtractTextPlugin({ filename: 'css/main.[contenthash].css'}),
        new globalizePlugin({
            production: false,
            developmentLocale: "en",
            supportedLocales: ["en"],
            output: "globalize-compiled-data-[locale].[hash].js"
        }),
        new HtmlWebpackPlugin({
            template: 'template/index.ejs',
            chunks: ['app']
        }),
        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: JSON.stringify('production')
            }
        })
    ]
}

Any ideas what the issue is?

@efernandesng
Copy link
Contributor

Hi @peejaybee

I don't have tested react-widgets-webpack with webpack 2, but I'll need do some changes to solve this.
If you can't wait, you can check bootstrap-webpack or/and font-awesome-webpack solutions.

@peejaybee
Copy link
Author

OK, thank you.

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

No branches or pull requests

2 participants