Webpack 无法呈现快速导入

tim*_*mue 3 javascript node.js webpack

NodeJS /Express:在我添加到 src 文件 ( )之后,Webpack 无法转换src/server/app.js为。dist/server/app.jsimport express from 'express'src/server/app.js


错误消息如下所示:

ERROR in ./~/express/lib/request.js
Run Code Online (Sandbox Code Playgroud)

详细:

Module not found: Error: Can't resolve 'net'
 in '/Users/timo/Desktop/Eggs/node_modules/express/lib'
Run Code Online (Sandbox Code Playgroud)

或者

ERROR in ./~/express/lib/view.js
Run Code Online (Sandbox Code Playgroud)

详细:

Module not found: Error: Can't resolve 'fs'
 in '/Users/timo/Desktop/Eggs/node_modules/express/lib'
Run Code Online (Sandbox Code Playgroud)

我是否必须更改webpack.config.babel.js文件中的某些内容

这里是:

export default [
  {
    entry: './src/server/app.js',
    output: {
      path: './dist/server',
      filename: 'app.js'
    },
    module: {
      loaders: [{
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        query: { presets: ['es2015', 'react'] }
      }]
    }
  },
    {
    entry: './src/client/app.js',
    output: {
      path: './dist/client',
      filename: 'app.js'
    },
    module: {
      loaders: [{
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        query: { presets: ['es2015', 'react'] }
      }]
    }
  }
]
Run Code Online (Sandbox Code Playgroud)