Adding Bower Package to Multiple Output Files (manifest.json)

I need to add a bower package to two different final js files. However, when I create an entry in manifest.json to add the bower package to the new file it is removed from the main.js file.

How can I keep it in the main file, and add to another as well?

Let’s see what you’ve done so far.

Here you go, I’m trying to get select2 into a separate file for use in an iframed Tinymce dialog. I guess I’ll need to ultimately do the same for it’s associated stylesheets, etc, but right now my main concern is that once I add the package to another file it is removed from main.

Thanks,

{
  "dependencies": {
    "main.js": {
      "files": [
        "scripts/main.js"
      ],
      "main": true
    },
    "main.css": {
      "files": [
        "styles/main.scss",
        "styles/extra.less"
      ],
      "base":"",
      "main": true
    },
    "customizer.js": {
      "files": [
        "scripts/customizer.js"
      ]
    },
    "jquery.js": {
      "bower": ["jquery"]
    },
    "select2.js": {
      "bower": ["select2"]
    },  
  },
  "config": {
    "devUrl": "http://example.dev"
  }
}

I would suggest just enqueueing the select2 js file where you need it on the main site.

The asset builder is basically set up so there is no duplication of code. Since it automatically pulls everything in to main.js the sane assumption is that if you want a package or packages in a separate file, then you would only be using those on specific pages.