Why add brunch to this requirejs code?

I have a file app/js/d3.jsin a brunch project that uses requirejs. When I create the file, the code in is app/js/d3.jsmerged into app.js, as expected. But this is wrapped up in what looks like some kind of need code, as follows:

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

I'm new enough to demand that I cannot say if this should happen, or if this is an unexpected behavior from Brunch. When I search for require api for registration, I do not see the registration method.

What's happening? Why is my code wrapping this way? My config.coffee looks like this:

  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'
        ]
+4
source share
1 answer

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

Source: https://habr.com/ru/post/1527647/


All Articles