我app/js/d3.js
在一个使用 requirejs 的早午餐项目中有一个文件。当我构建文件时,其中的代码按预期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
我足够新,以至于我无法判断这是否应该发生,或者这是否是早午餐的意外行为。当我在需要 api中搜索register 时,我没有看到 register 方法。
这是怎么回事?为什么我的代码会这样包装?我的 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'
]