Error when running webpack: Can not find module '/webpack/webpack.server.config.js' [closed]

1

It's the first time I'm trying to use webpack to develop applications with react. In webpack.server.config.js I have the following code:

module.exports = {
  entry: './source/server.js',
  output: {
    filename: 'index.js',
    path: './built/server',
  },
  module: {
    loaders: [
      {
        test: /\.json$/,
        loader: 'json',
      },
      {
        test: /\.jsx?$/,
        loader: 'babel',
        exclude: /(node_modules)/,
        query: {
          presets: ['latest-minimal', 'react']
        }
      }
    ]
  },
  target: 'node',
}

In the file webpack.config.js I have the following:

const server = require('./webpack/webpack.server.config.js');

module.exports = [
  server,
];

I have already installed webpack, even with sudo npm i -g webpack , but when I run the webpack command in the ubuntu console I get the following error:

If someone can tell me why it does not work, I thank you very much.

    
asked by Lorem 13.01.2017 в 00:49
source

0 answers