Saturday 18 March 2017

Does react-router-dom require react-router to work?

I'm trying to work with the react-router-dom v4, and I got it working, but something strange is happening.

I was following some tutorials that are based on react-router, and I switched to react-router-dom because I just couldnt get react-router to work. I'm not using the react-router anywhere in my app.

I compile everything with webpack and the app is working, I can use the routes and links. If I uninstall react-router - npm uninstall react-router --save and I try to run webpack I get:

D:\Projects\IntelligentWeb>webpack
crypto.js:74
  this._handle.update(data, encoding);
               ^

TypeError: Data must be a string or a buffer
    at TypeError (native)
    at Hash.update (crypto.js:74:16)
    at HarmonyExportImportedSpecifierDependency.updateHash (D:\Projects\IntelligentWeb\node_modules\webpack\lib\dependencies\HarmonyExportImportedSpecifierDependency.js:144:8)
    at D:\Projects\IntelligentWeb\node_modules\webpack\lib\DependenciesBlock.js:33:5
    at Array.forEach (native)
    at NormalModule.DependenciesBlock.updateHash (D:\Projects\IntelligentWeb\node_modules\webpack\lib\DependenciesBlock.js:32:20)
    at NormalModule.Module.updateHash (D:\Projects\IntelligentWeb\node_modules\webpack\lib\Module.js:162:41)
    at NormalModule.updateHash (D:\Projects\IntelligentWeb\node_modules\webpack\lib\NormalModule.js:327:30)
    at modules.forEach.m (D:\Projects\IntelligentWeb\node_modules\webpack\lib\Chunk.js:253:31)
    at Array.forEach (native)
    at Chunk.updateHash (D:\Projects\IntelligentWeb\node_modules\webpack\lib\Chunk.js:253:16)
    at Compilation.createHash (D:\Projects\IntelligentWeb\node_modules\webpack\lib\Compilation.js:1121:10)
    at sealPart2 (D:\Projects\IntelligentWeb\node_modules\webpack\lib\Compilation.js:605:9)
    at Compilation.applyPluginsAsyncSeries (D:\Projects\IntelligentWeb\node_modules\tapable\lib\Tapable.js:131:46)
    at Compilation.seal (D:\Projects\IntelligentWeb\node_modules\webpack\lib\Compilation.js:570:8)
    at D:\Projects\IntelligentWeb\node_modules\webpack\lib\Compiler.js:474:16
    at D:\Projects\IntelligentWeb\node_modules\tapable\lib\Tapable.js:225:11
    at _addModuleChain (D:\Projects\IntelligentWeb\node_modules\webpack\lib\Compilation.js:472:11)
    at processModuleDependencies.err (D:\Projects\IntelligentWeb\node_modules\webpack\lib\Compilation.js:443:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Why is this happening? Does react-router-dom somehow need the react-router?

If I install it back it will compile again.

This is my webpack config:

module.exports = {
    entry: './app-client.js',
    devtool: '#eval-source-map',
    output: {
        path: __dirname + '/public/js',
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /(node_modules|app-server.js)/,
                loader: 'babel-loader'
            }
        ]
    }
};



via Bogdan Daniel

No comments:

Post a Comment