我在一个使用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
我足够新,要求我不知道这是否应该发生,或者这是否是Brunch的意外行为。当我在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'
]
答案 0 :(得分:2)
我只需将此代码添加到配置文件
files:
...
modules: //this stops the wrapping
wrapper: false