Why do modules such as the webpack request (‘request’) server side report errors?

  node.js, question

The test file is simple:

var request = require('request');
 var crypto = require('crypto');

But will report an error:

ERROR in ./~/.npminstall/tough-cookie/2.3.1/tough-cookie/package.json
 Module parse failed: C:\Users\Administrator\Desktop\submail\submail\node_modules
 You may need an appropriate loader to handle this file type.
 SyntaxError: Unexpected token (2:10)
 at Parser.pp$4.raise (C:\Users\Administrator\AppData\Roaming\npm\node_module
 at Parser.pp.unexpected (C:\Users\Administrator\AppData\Roaming\npm\node_mod
 at Parser.pp.semicolon (C:\Users\Administrator\AppData\Roaming\npm\node_modu
 at Parser.pp$1.parseExpressionStatement (C:\Users\Administrator\AppData\Roam
 at Parser.pp$1.parseStatement (C:\Users\Administrator\AppData\Roaming\npm\no
 at Parser.pp$1.parseBlock (C:\Users\Administrator\AppData\Roaming\npm\node_m
 at Parser.pp$1.parseStatement (C:\Users\Administrator\AppData\Roaming\npm\no
npm install --save-dev json-loader

The webpack configuration also needs to be modified.

module.exports = {
 entry: 'index',
 output: {
 path: path.join(__dirname, 'scripts'),
 filename: 'bundle.js'
 },
 module: {
 loaders: [
 { test: /\.json$/, loader: 'json-loader' }
 bracket
 },
 resolve: {
 extensions: ['', '.webpack.js', '.web.js', '.js']
 },
 node: {
 console: 'empty',
 fs: 'empty',
 net: 'empty',
 tls: 'empty'
 bracket
 };

Referenceshttps://github.com/request/re …