Giter Club home page Giter Club logo

Comments (8)

smrq avatar smrq commented on May 20, 2024

Are you sure that you are including tsify as a plugin correctly? Those imports look correct, and the error message is what I would expect if the input got to browserify without being compiled to Javascript first. What does your build setup look like?

from tsify.

rob-bateman avatar rob-bateman commented on May 20, 2024

ah, i don't have the exact setup as i've since overwritten it to something that precompiles the typescript before handing it to browserify. But to recreate the tsify implementation, it was something like:

glob('./src/away/**/*.ts', {}, function (error, files) {
    var b = browserify({
        debug: true,
        paths: ['./src']
    });

    files.forEach(function (file) {
        b.require(file, {expose:path.relative('./src', file.slice(0,-3))});
    });

    b.plugin('tsify', { target: 'ES5' })
        .bundle()
        .pipe(source('awayjs-core.js'))
        .pipe(gulp.dest('./build'));

    callback();
});

Is it possibly todo with the fact that i'm adding classes using require() rather than add() ? The latter isn't possible for me due to the fact that the classes have to be exposed for external use in an implementing application

from tsify.

smrq avatar smrq commented on May 20, 2024

Oh, that's an interesting setup. Yeah, that could very well be the culprit.
I'll try it out when I get back to my dev box.

One other thing that comes to mind immediately is that every file passed to
Browserify is considered an entry point, sort of like including each file
as a script tag. That's not really ideal because you might end up with
script ordering issues just like if you didn't use Browserify at all. So I
haven't really tested that scenario.
On Oct 1, 2014 6:38 PM, "Rob Bateman" [email protected] wrote:

ah, i don't have the exact setup as i've since overwritten it to something
that precompiles the typescript before handing it to browserify. But to
recreate the tsify implementation, it was something like:

glob('./src/away/*/.ts', {}, function (error, files) {
var b = browserify({
debug: true,
paths: ['./src']
});

files.forEach(function (file) {
    b.require(file, {expose:path.relative('./src', file.slice(0,-3))});
});

b.plugin('tsify', { target: 'ES5' })
    .bundle()
    .pipe(source('awayjs-core.js'))
    .pipe(gulp.dest('./build'));

callback();

});

Is it possibly todo with the fact that i'm adding classes using require()
rather than add ?


Reply to this email directly or view it on GitHub
#11 (comment).

from tsify.

rob-bateman avatar rob-bateman commented on May 20, 2024

yeah i was initially worried about that too but to its credit browserify doesn't have any trouble with this approach as far as i can tell. Things run great, even with my code mess ;)

thanx for taking a look, be keen to see if a pure browserify implementation is possible as it would open the door to other possibilities like using watchify on my codebase

from tsify.

smrq avatar smrq commented on May 20, 2024

Oh, I take it back! Never respond to issues while drinking margaritas. :)

Using require instead of add means that no file is added as an entry
point, unless you pass the option entry: true. I'm not totally sure what
that actually means once the whole bundle is put together, but tsify looks
at the entry point(s) to determine what to compile, so that totally
explains the ultimate behavior you saw. I'll figure out what it should do
soon. Thanks for reporting, I'll figure this one out.

from tsify.

smrq avatar smrq commented on May 20, 2024

I fixed a small error on this end, but ultimately this issue is caused by browserify/browserify#937. Blocking on resolution of this issue. In the meantime, specify at least one file as an entry point!

from tsify.

rob-bateman avatar rob-bateman commented on May 20, 2024

aha! ok interesting, will try it out. thanks for the update

from tsify.

smrq avatar smrq commented on May 20, 2024

Fixed way upstream in [email protected]! No more hacks needed.

from tsify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.