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

Require function give wrong object #145

Open
iKBAHT opened this issue May 20, 2016 · 2 comments
Open

Require function give wrong object #145

iKBAHT opened this issue May 20, 2016 · 2 comments

Comments

@iKBAHT
Copy link

iKBAHT commented May 20, 2016

In version 0.15.4 and higher our project has problem (in 0.15.3 it works). We use grunt-browserify with aliases. Example of config for grunt:

app: {
  files: {'bundle.js': ['app/main.ts']},
  options: {
    alias: ["./app/js/common/util.ts:docsUtil"]
    configure: function tsify(b) {
      b.plugin('tsify');
    }
  }
}

Bundle creation finish normally, but when it runs in browser there are error. Error happens because require('docsUtil') return an empty object (docsUtil is alias to real module).

@timofei-iatsenko
Copy link

Check what is in compilled output. Seems this module will be empty in bundle.

@cartant
Copy link
Contributor

cartant commented Aug 28, 2016

The grunt-browserify alias option cannot be supported by tsify as it is currently implemented. Said option tweaks the way Browserify resolves modules. However, the TypeScript compilation would need to resolve modules the same way and, at the moment, that's not possible.

This might be something that could be addressed with the module resolution enhancements in TypeScript 2, but I have not yet looked into it, as there is a bug in the TypeScript 2.0.0 beta causes problems for tsify and I'm waiting for the release - which should include a fix.

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

No branches or pull requests

3 participants