Phoenix: Splitting brunch files into app.js and vendor.js does not work per the inline comments

Created on 17 Apr 2017  路  2Comments  路  Source: phoenixframework/phoenix

Generated a new project with mix phx.new and followed the instructions in the generated brunch-config.js file. With the following excerpt from my brunch-config.js file:

  files: {
    javascripts: {
      // joinTo: "js/app.js",

      // To use a separate vendor.js bundle, specify two files path
      // https://github.com/brunch/brunch/blob/master/docs/config.md#files
      joinTo: {
       "js/app.js": /^(js)/,
       "js/vendor.js": /^(vendor)|(deps)/
      },
      //
      // To change the order of concatenation of files, explicitly mention here
      // https://github.com/brunch/brunch/tree/master/docs#concatenation
      order: {
     // ...

I get the following warns form brunch build.

13:33:28 - warn: node_modules/phoenix_html/priv/static/phoenix_html.js compiled, but not written. Check your javascripts.joinTo config
13:33:28 - warn: node_modules/phoenix/priv/static/phoenix.js compiled, but not written. Check your javascripts.joinTo config

What am I doing wrong? Should comments be updated?

Most helpful comment

Just as a side note, the Brunch documentation suggests the following:

module.exports = {
  files: {
    javascripts: {
      joinTo: {
        'app.js': /^js/,       // all code from 'js/',
        'vendor.js': /^(?!js)/ // all BUT js code - 'vendor/', 'node_modules/', etc
      }
    }
  }
}

All 2 comments

Looks like "js/vendor.js": /^(vendor|deps|node_modules).*/ resolves the issue. Are you interested in a PR to update the boilerplate with the change?

Just as a side note, the Brunch documentation suggests the following:

module.exports = {
  files: {
    javascripts: {
      joinTo: {
        'app.js': /^js/,       // all code from 'js/',
        'vendor.js': /^(?!js)/ // all BUT js code - 'vendor/', 'node_modules/', etc
      }
    }
  }
}
Was this page helpful?
0 / 5 - 0 ratings