-
Notifications
You must be signed in to change notification settings - Fork 92
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
not compiling on production after update to browserify 14.3.0 #202
Comments
I'm having the same issue. In production and staging, all of the files being processed through browserify come out empty with browserify 14.1.0+. I tried 13.3.0-14.4.0 and it worked with 13.3.0 and 14.0.0, but everything above that failed. Another thing is this problem only appears in the newer versions of browserify if browserify-incremental is disabled. Enabling it makes browserify-rails work with the latest browserify. You can do this by putting the following line in config.browserify_rails.use_browserifyinc = true
|
The pull request for browserify 14.1.0 has this comment, which might have something to do with this issue: browserify/browserify#1673 (comment) |
As of v3.1.0, browserify-incremental no longer requires |
It might also be that the piping mode of browserify is broken. Last time it broke (a couple years ago), I submitted a PR for the bug. substack suggested maybe doing a test for it too but there were more pressing issues and (this reminded me) it never got done. So first thing I'd do is pull down the new browserify and do some basic manual tests of piping a module in and making sure it emits the expected output. |
I ran into this as well. It looks like browserify is expecting to find .js files under app/assets. Running browserify manually shows an error:
Since browserifyinc fixes this, I suspect that these are compiled into the cache and then found there. Otherwise it's looking for .js files, but there are only .coffee, .jsx, etc. files in the source location. In addition to fixing the compilation issue, it should not fail silently on similar errors when running browserify and it gives exit status 1. |
@avit That might be a browserify-rails configuration issue and not an issue with browserify itself. Are you adding the additional paths to |
@cymen, no, these are not outside of app/assets. Just adding My file looked like this (js.coffee):
The output included items one and two, but silently ignored everything from So, possibly something about the build order and those files not being compiled first as dependencies? |
Hrm.. That is odd. My recommended approach is to put all of the code that uses CommonJS in one entry point that gets required via the sprockets require calls. If there are multiple entry points into CommonJS, it seems like it can cause problems. But I never looked into it in greater depth so there might be other ways to do this that work well. |
Same issue here and I second @avit. Seems this happens because browserify has no anchor point to resolve relative paths, since input is piped via stdin. To reproduce, simply take the command logged by browserify-rails:
However, this would work:
Setting |
I have update the browser package version to 14.3.0 and it seems to not be compiling the files correctly, on
rake assets:precompile
everything looks fine, no errors, but after launch the app and go to the page i'm using some JS i'm gettingReferenceError: MyComponent is not defined
, but if i come back to previous version (13.3.0), and precompile, everything works fine.It is just failing at production mode, in development it works as expected.
I've tried to look for the Component declaration within the compiled files and it doesn't appears anywhere, but in the development compiled version it does.
The text was updated successfully, but these errors were encountered: