Customizing Cordova with React and WebPack

Hello, I want to configure cordova to use responseJs. For this I use webpack. When I start webpack, I got the following error:

ERROR in ./~/babel-core/lib/helpers/resolve.js
Module not found: Error: Can't resolve 'module' in '/home/miro_g/Bureau/EVOLT/test2/node_modules/babel-core/lib/helpers'
 @ ./~/babel-core/lib/helpers/resolve.js 34:14-31
 @ ./~/babel-core/lib/transformation/file/index.js
 @ ./~/babel-core/lib/api/node.js
 @ ./~/babel-core/index.js
 @ ./www/js/index.js
 @ multi webpack/hot/dev-server ./www/js/index.js

ERROR in ./~/debug/src/node.js
Module not found: Error: Can't resolve 'net' in '/home/miro_g/Bureau/EVOLT/test2/node_modules/debug/src'
 @ ./~/debug/src/node.js 191:16-30
 @ ./~/debug/node.js
 @ ./~/babel-core/lib/transformation/file/logger.js
 @ ./~/babel-core/lib/transformation/file/index.js
 @ ./~/babel-core/lib/api/node.js
 @ ./~/babel-core/index.js
 @ ./www/js/index.js
 @ multi webpack/hot/dev-server ./www/js/index.js

And if you want to see my webpack configuration:

    var path = require('path');
var webpack = require("webpack");

module.exports = {
    entry: {
        app: ['webpack/hot/dev-server', './www/js/index.js']
    },
    output: {
        path: __dirname + '/www/',
        filename: 'bundle.js'
    },
    devServer: {
        contentBase: './www',
        publicPath: 'http://localhost:8080/'
    },

    module: {
        loaders: [{
                test: /\.jsx?$/,
                loader: 'babel-loader',
                exclude: /node_modules/,
                query: {
                    presets: ['es2015', 'react'],
                    plugins: ['transform-class-properties']
                },
            },
            { test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192' },
            { test: /\.css$/, loader: 'style-loader!css-loader' },
            {
                test: /\.(eot|svg|ttf|woff|woff2|otf)$/,
                loader: 'file?name=fonts/montserrat/[name].[ext]'
            },
            {
                test: /\.elm$/,
                exclude: [/elm-stuff/, /node_modules/],
                loader: 'elm-webpack'
            }
        ],
        noParse: /\.elm$/
    },

    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.IgnorePlugin(new RegExp("^(fs|ipc)$"))
    ]
};

I do not understand my mistake, please help me !!!!

+4
source share

Source: https://habr.com/ru/post/1675335/


All Articles