Skip to content

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

Description

@mnoble01

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions