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

No value is exported from my es6 module after applying aliasify transform #44

Open
mnoble01 opened this issue Jul 29, 2016 · 7 comments

Comments

@mnoble01
Copy link

mnoble01 commented Jul 29, 2016

I have an underscore-extend file that I'd like to alias for all calls to require('underscore'). The reason for this is I'm mixing in some of my own functions to underscore and I'd like them to be available anywhere underscore is required in my codebase.

Here's my underscore-extend.js:

import _ from 'vendor/underscore'

_.mixin({
...
})

export default _

And my gulp task code:

 let b = browserify({
    entries: `./app/${app}/index.js`, 
    debug: true,
    detectGlobal: false,
    paths: [
      './app/shared/',
      './app/shared/lib/',
      './app/'
    ]
  }).transform(browserifyShim) // config must be in package.json
    .transform('babelify', {presets: ['es2015'], compact: false})
    .transform('brfs')
    .transform(aliasify, {
      aliases: {
        vendor: './vendor',
        underscore: {relative: 'shared/lib/underscore-extend'}
      },
      verbose: false,
      debug: true
    })

The problem is that there is no value exported from underscore-extend when I use import _ from 'underscore'. When I used import 'underscore', _ is defined correctly in scope and all my mixins are present, but I'd rather not change my entire codebase to use import without assignment.

I've also tried underscore: './app/shared/lib/underscore-extend' and got the same result.

@jwalton
Copy link
Contributor

jwalton commented Nov 1, 2016

Does 2.1.0 fix this? We upgrade to the latest falafel, which supports ES6 syntax.

@IonicaBizau
Copy link

@jwalton @mnoble01 Did you find any solution to this issue? It happens to me in a similar context (when using import and babelify).

@IonicaBizau
Copy link

I'm using aliasify@2.1.0.

@LinusBorg
Copy link

Shouldn't the export be. export { _ as default }?

@IonicaBizau
Copy link

@LinusBorg import foo from "normal-es5-module" should work, even normal-es5-module does module.exports = foo, shouldn't it?

@IonicaBizau
Copy link

For reference, I'm adding the files to browserify, using the add method, not passing them into an entries array.

@mnoble01
Copy link
Author

I'm actually not working on that project anymore and this was almost a year ago. I can't comment on a solution here. Good luck! I'll be interested to see what you all find out.

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

No branches or pull requests

4 participants