Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shim dependencies ignored #184

Open
paulozoom opened this issue Nov 14, 2016 · 2 comments
Open

Shim dependencies ignored #184

paulozoom opened this issue Nov 14, 2016 · 2 comments

Comments

@paulozoom
Copy link

paulozoom commented Nov 14, 2016

Hi!

I’m running into an issue where a browserify-shim dependency isn’t being included.

browserify-rails config:

Rails.application.config.browserify_rails
     .commandline_options = [
       '-t [ babelify --presets [ es2015 react stage-0 ] --plugins [ lodash ] ]',
       '-t [ browserify-shim ]'
     ]

package.json:

  "browserify": {
    "transform": [
      "browserify-shim",
      ["babelify", {
        "presets": ["es2015", "react", "stage-0"],
        "plugins": ["lodash"]
      }]
    ]
  },
  "browser": {
    "bs-dropdown": "./node_modules/bootstrap/js/dist/dropdown.js",
    "bs-util": "./node_modules/bootstrap/js/dist/util.js"
  },

Relevant part of application.js

import 'bs-dropdown';

However, browserify-rails isn’t including the util.js dependency. If I precompile the assets, that file isn’t included (tested with grepping for a particular line of code).

However, if I run it manually, as such:

./node_modules/.bin/browserify -d --extension=es6 -t [ babelify --presets [ es2015 react stage-0 ] --plugins [ lodash ] ] -t [ browserify-shim ] app/assets/javascripts/application.js -o bundle.js

Then the dependency is included.

@cymen
Copy link
Member

cymen commented Feb 7, 2018

You might try turning off browserifyinc to see as your manual test is direct w/o browserifyinc. Sorry for the slow response.

@paulozoom
Copy link
Author

paulozoom commented Feb 7, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants