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

Does aliasify work with CoffeeScript files? #28

Open
bennycode opened this issue Jun 19, 2015 · 4 comments
Open

Does aliasify work with CoffeeScript files? #28

bennycode opened this issue Jun 19, 2015 · 4 comments

Comments

@bennycode
Copy link

I am using grunt-browserify with these transforms declared in my package.json:

"browserify": {
  "transform": [
    "aliasify",
    "coffeeify",
    "browserify-shim"
  ]
}

When aliasify scans my CoffeeScript files then I get an error because it does not like CoffeScript symbols like ?=:

SyntaxError: Unexpected token (1:10) (while aliasify was processing config.coffee)

What can I do to make aliasify work with CoffeeScript?

I want to replace statements like:

CoreEvent = require '../../../core/coffee/event/CoreEvent.coffee'
@jwalton
Copy link
Contributor

jwalton commented Jun 19, 2015

It does, although you need to have coffeeify ahead of aliasify in your transform stack.

@bennycode
Copy link
Author

I tried that but then coffeify complains about not being able to resolve the mapping for require 'CoreEvent'.

@jwalton
Copy link
Contributor

jwalton commented Jun 19, 2015

Do you have a small example project I can try this out on? We're using coffeeify and aliasify together (although we're running [email protected], which is a bit old.)

@maraujop
Copy link

@bennyn I've made aliasify work with vueify having the exact same issue you had. This is how I've done it in my gulpfile:

    var aliasifyConfig = {
      "aliases": {
        "app": "./static/"
      },
      appliesTo: {
        "includeExtensions": ['.js', '.vue']
      }
    }

    return browserify({
      entries: [entry],
    })
      .transform(babelify)
      .transform(vueify)
      .transform(aliasify, aliasifyConfig)
      .bundle()

I read this section on browserify docs on how to make it follow different extensions, you would need to put .coffee in includeExtensions and I'm quite sure it would start working for you too.

Cheers,
Miguel

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

3 participants