【问题标题】:Why is brunch adding in this requirejs code?为什么 brunch 在此 requirejs 代码中添加?
【发布时间】:2014-03-19 06:36:36
【问题描述】:

我在一个使用 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

我是新手,我无法判断这是否应该发生,或者这是否是早午餐的意外行为。当我在require api 中搜索注册时,我没有看到注册方法。

发生了什么事?为什么我的代码会这样包装?我的 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'
        ]

【问题讨论】:

    标签: javascript requirejs brunch


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多