带有fuse-box的反应节点应用程序TypeError:require(...)不是函数

问题描述 投票:0回答:1

我正在使用fuse-box构建React和Node(express)应用程序

const ap = express()导致此错误:

`path/to/projct/react/react-skeleton/build/ssr/development/bundle.js:7624
    require("./streams")(iconv);
                        ^
TypeError: require(...) is not a function
.
.
.`

这是fuse.js文件的babel配置:

let  babelPresetEnv = [
  'env',
  {
    targets: {
      browsers
    },
  }
]

_.BabelPlugin({
  config: {
    sourceMaps: true,
    presets: ['react', 'stage-0', babelPresetEnv],
    plugins: [
      'babel-plugin-transform-decorators-legacy',
      'babel-plugin-transform-class-properties',
      'babel-plugin-transform-object-rest-spread',
      'babel-plugin-transform-es2015-spread',
      'babel-plugin-transform-object-assign'
    ].map(require.resolve)
  }
}),

我完全没有解决它..提前感谢..

javascript node.js reactjs babeljs
1个回答
0
投票

我尝试了一切,最后降级快递解决了它:"express": "4.15.4",

© www.soinside.com 2019 - 2024. All rights reserved.