jQWidgets Forums

jQuery UI Widgets Forums React Webpack Module Parse Failed Reply To: Webpack Module Parse Failed

Webpack Module Parse Failed #94722

adrian_hd
Participant

Hi, have the same problem, Add the above configuration and now check this:


ERROR in ./src-standard/index.js
Module parse failed: C:\Repositorios\siag-fe\src-standard\index.js Unexpected to
ken (34:14)
You may need an appropriate loader to handle this file type.
|               gFechaTrabajo : ' 31/03/2017',
|               gFechaActual: 'Jueves, 28 de Mayo de 2015',
|               gIcono: <Glyphicon glyph="glyphicon glyphicon-minus"/>,
|               startDate: moment(),
|               gContenido : <Home/>,
 @ multi (webpack)-dev-server/client?http://0.0.0.0:9020 webpack/hot/dev-server
./src-standard/index.js 

So this is my configuration:


const webpack = require('webpack');
const path = require('path');

module.exports = {
    entry: "./src-standard/index.js",
    output: {
        path: __dirname,
        filename: "dist/bundle.js"
    },
    devServer: {
      host: '0.0.0.0',
      port: 9020
    },

    module: {
        rules: [
            {
                test: /\.css$/,
                use: [
                    {
                        loader: "style-loader"
                    },
                    {
                        loader: "css-loader"
                    }
                ]
            },
            {
                test: /\.(woff|woff2|eot|ttf|otf|less|scss)$/i,
                use: [
                    {
                        loader: "file-loader",
                        options: {
                            name : "fonts/[name]-[hash].[ext]"
                        } 
                    }
                ]
            },
            {
                test: /\.(jpe?g|png|gif|svg)$/i,
                use: [
                    {
                        loader: "file-loader",
                        options: {
                            name : "images/[name]-[hash].[ext]"
                        } 
                    }
                ]
            },
            {
                test: /\.js$|\.jsx$/,
                include: [
                    path.resolve(__dirname, 'node_modules/jqwidgets-framework/jqwidgets-react')
                ],
	        exclude: /(node_modules|bower_components)/, 
                loader: 'babel-loader',
                    options: {
                        presets: ['react', 'es2015'],
                        plugins: ['syntax-dynamic-import']
                    }
            }
        ]
    },
    resolve: {
        alias: {
            "lib-root" : __dirname + "/node_modules",
            "app-root" : __dirname + "/src-standard"
        }
    },

    plugins:[
        new webpack.DefinePlugin({
            PRODUCTION: JSON.stringify(true),
            VERSION: JSON.stringify("5fa3b9"),
            BROWSER_SUPPORTS_HTML5: true,
            "typeof window": JSON.stringify("object")
        })
    ]
};

Apparently I do not recognize the JSX, please tell me if I miss something