Javascript 早午餐可以建立,但是;找不到模块';缓冲区'&引用;公开

Javascript 早午餐可以建立,但是;找不到模块';缓冲区'&引用;公开,javascript,build,brunch,Javascript,Build,Brunch,我们正在尝试将前端构建转换为使用早午餐。这是我到目前为止的早午餐配置: module.exports = { files: { javascripts: { joinTo: { 'vendor.js': /^(?!source)/, 'app.js': /^source/ }, entryPoints: { 'source/scripts/app.jsx': 'app.js' }

我们正在尝试将前端构建转换为使用早午餐。这是我到目前为止的早午餐配置:

module.exports = {

  files: {
    javascripts: {
      joinTo: {
        'vendor.js': /^(?!source)/,
        'app.js': /^source/
      },
      entryPoints: {
        'source/scripts/app.jsx': 'app.js'
      }
    },
    stylesheets: {joinTo: 'core.css'},
  },

  paths: {
    watched: ['source']
  },

  modules: {
    autoRequire: {
      'app.js': ['source/scripts/app']
    }
  },

  plugins: {
    babel: {presets: ['latest', 'react']},
    postcss: {processors: [require('autoprefixer')]},
    assetsmanager: {
      copyTo: {
        'assets': ['source/resources/*']
      }
    },
    static: {
      processors: [
        require('html-brunch-static')({
          processors: [
            require('pug-brunch-static')({
              fileMatch: 'source/views/home.pug',
              fileTransform: (filename) => {
                filename = filename.replace(/\.pug$/, '.html');
                filename = filename.replace('views/', '');
                return filename;
              }
            })
          ]
        })
      ]
    }

  }

};
我在早午餐配置中添加了
modules.autoRequire
部分,然后发生了以下错误。没有
模块。自动请求
我没有控制台错误,但我的web应用程序也无法启动。运行
早午餐构建
不会导致错误,但是当我打开构建的网站时,我会得到错误

未捕获错误:无法从“lodash/lodash.js”中找到模块“buffer”

stacktrace中的第一行指向vendor.js中的这个函数

var require = function(name, loaderPath) {
  if (loaderPath == null) loaderPath = '/';
  var path = expandAlias(name);

  if (has.call(cache, path)) return cache[path].exports;
  if (has.call(modules, path)) return initModule(path, modules[path]);

  throw new Error("Cannot find module '" + name + "' from '" + loaderPath + "'");
};
我不知道如何继续让我的构建工作。这似乎是相关的


我怎样才能克服这个错误?(请随时询问其他信息。我不确定所有这些都会有什么帮助。)

Brunch从
package.json
中定义的(特定于早午餐的)npm包中执行构建管道的步骤。因此,确保包含所有需要的包(或删除不必要的包)


请参阅。

什么是您的
包.json
?@JohannesFilter感谢您的评论,我从我的
包.json
中删除了不必要的包,现在它可以工作了。