Cannot resolve modules ‘fs’ ‘net’ ‘tls’ when using Couchbase

Good afternoon,

We are trying to use the node module for Couchbase. When just using var couchbase = require(‘couchbase’) we ran into this while building:

my webpack.config looks like:

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

module.exports = {
    context: path.join(__dirname, "src"),
    devtool: debug ? "inline-sourcemap" : null,
    entry: "./js/client.js",
    module: {
        loaders: [
                test: /\.json$/,
                loader: 'json'
                test: /\.jsx?$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'babel-loader',
                query: {
                    presets: ['react', 'es2015', 'stage-0'],
                    plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'],
    node: {
      fs: 'empty',
      net: 'empty',
      tls: 'empty',
      dns: 'empty'
    output: {
        path: __dirname + "/src/",
        filename: "client.min.js"
    plugins: debug ? [
        new webpack.IgnorePlugin(/^(buffertools)$/)
    ] : [
        new webpack.IgnorePlugin(/^(buffertools)$/),
        new webpack.optimize.DedupePlugin(),
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
    devServer: {
        historyApiFallback: true

I recently added the node: {} element and now I’m getting:

WARNING in .//bindings/bindings.js
Critical dependencies:
76:22-40 the request of a dependency is an expression
76:43-53 the request of a dependency is an expression
@ ./
/bindings/bindings.js 76:22-40 76:43-53
webpack: bundle is now VALID.

In chrome console i am seeing error:

Uncaught ReferenceError: require is not defined

We are on Node 6.2.0, please let me know if you need anymore details


Author: Fantashit

1 thought on “Cannot resolve modules ‘fs’ ‘net’ ‘tls’ when using Couchbase

Comments are closed.