Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

requirejs precompile not supported with es6 files from sprockets-es6 gem #241

Open
chenxeed opened this issue Jul 3, 2015 · 6 comments
Open

Comments

@chenxeed
Copy link

chenxeed commented Jul 3, 2015

Hi.

I installed both sprockets-es6 and requirejs-rails in my Rails app.

I changed some of my javascript files to *.es6 extension so that Rails asset pipeline can compile those files to *.es5 from gem sprockets-es6.

Those files also loads normally on requirejs-rails development mode, but unfortunately it returns error on precompiling. The error is something like this:

{ [Error: Error: ENOENT, no such file or directory '/home/chenx/Projects/piktov2-rails/tmp/requirejs/dst/view/templates.js'
In module tree:
    controller/templates

    at Object.fs.openSync (fs.js:432:18)
]
  originalError: 
   { [Error: ENOENT, no such file or directory '/home/chenx/Projects/piktov2-rails/tmp/requirejs/dst/view/templates.js']
     errno: 34,
     code: 'ENOENT',
     path: '/home/chenx/Projects/piktov2-rails/tmp/requirejs/dst/view/templates.js',
     syscall: 'open',
     fileName: '/home/chenx/Projects/piktov2-rails/tmp/requirejs/dst/view/templates.js',
     moduleTree: [ 'controller/templates' ] } }

The file can't be found because it is already named as .es6, hence: /view/templates.es6 and precompiler can't find it.

Need any assistance or suggestions here to support both gems. Thank you :)

@chenxeed
Copy link
Author

chenxeed commented Jul 9, 2015

What I was wondering, is it possible that the assets that we're going to digestify and compress is the file from sprockets, instead of fresh file copy? Since if we get the file from sprockets, it will be transpiled to es5.

@chenxeed
Copy link
Author

chenxeed commented Jul 9, 2015

I tried to tweak some changes, and it seems work for me.
I made a pull-request about this, hopefully it's valid. If so, I can go back to use master branch as my Gem. (Right now I used my branch forked from requirejs-rails master branch)

#243

@carsomyr
Copy link
Collaborator

carsomyr commented Jul 9, 2015

@chenxeed Thanks for this. I'll have to read up on transpiling.

@chenxeed
Copy link
Author

chenxeed commented Jul 9, 2015

@carsomyr You're welcome! :) will love to hear your feedback about this.

@neoeno
Copy link

neoeno commented Sep 3, 2015

This would be super-great to have — for me it's the last missing piece to getting ES2015 modules to work in Rails. Just say if there's anything I can do to help move this along.

@chenxeed
Copy link
Author

chenxeed commented Sep 4, 2015

I've closed my previous PR and reopened it. Rebased and only took 1 commit to change :)

#251

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

No branches or pull requests

3 participants