Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/424.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么早午餐会加入这个requirejs代码?_Javascript_Requirejs_Brunch - Fatal编程技术网

Javascript 为什么早午餐会加入这个requirejs代码?

Javascript 为什么早午餐会加入这个requirejs代码?,javascript,requirejs,brunch,Javascript,Requirejs,Brunch,我在一个使用requirejs的早午餐项目中有一个文件app/js/d3.js。当我构建文件时,app/js/d3.js中的代码按预期连接到app.js中。但它被包装在一些看起来需要的代码中,如下所示: require.register("js/d3", function(exports, require, module) { #this wrapper is added window.onload = function() { #then there is the start of code

我在一个使用requirejs的早午餐项目中有一个文件
app/js/d3.js
。当我构建文件时,
app/js/d3.js
中的代码按预期连接到
app.js
中。但它被包装在一些看起来需要的代码中,如下所示:

require.register("js/d3", function(exports, require, module) { #this wrapper is added
window.onload = function() { #then there is the start of code from app/js/d3.js
我是一个新手,所以我不知道这是应该发生的还是早午餐中的意外行为。当我搜索寄存器时,我没有看到寄存器方法

发生什么事了?为什么我的代码会这样包装?我的config.coffee如下所示:

  files:
    javascripts:
      joinTo:
        "js/app.js": /^app/
        "js/vendor.js": /^(bower_components|vendor)/
      order:
        before: [
          'bower_components/queue-async/queue.js',
          'bower_components/topojson/topojson.js',
          'bower_components/topojson/topojson.js',
          'bower_components/d3/d3.js',
          'bower_components/requirejs/requirejs.js'
        ]

我只需要将此代码添加到我的配置文件中

  files:
    ...
  modules:  //this stops the wrapping
    wrapper: false