Code Monkey home page Code Monkey logo

Comments (4)

greypants avatar greypants commented on August 19, 2024

Just npm install --save-dev tsify and add it to the browserify transform array in package.json

from blendid.

yilativ avatar yilativ commented on August 19, 2024

I did that, but it looks like it did not work as the tsify plugin received just the string (my main.ts file path) instead of the stream or whatever object it expected.

So what I did was this in the browserify.js:

if (bundleConfig.plugins && b.plugin) {
                for (var pluginName in bundleConfig.plugins) {
                    var pluginSettings = bundleConfig.plugins[pluginName];
                    b.plugin(pluginName, pluginSettings);
                    console.log(pluginSettings);
                }
            }

and in my config.js:

bundleConfigs: [
            // Application
            {
                entries: [src + "/app.ts"],
                dest: dest,
                outputName: 'app.js',
                extensions: ['.ts', '.js'],
                plugins: {
                    "tsify": {
                        //Warn on expressions and declarations with an implied any type.
                        noImplicitAny: true,

                        //Do not emit comments to output.
                        removeComments: true,

                        //Specify ECMAScript target version: 'ES3' (default), or 'ES5'
                        target: "ES5",
                    }
                },
            }
        ]

That made it work, otherwise this is the code that would throw the exception because b is not whatever that object is but just a string:

    if (b._extensions.indexOf('.ts') === -1)

Not sure if that helps out anybody but that's how I ended up making this starter work.

Thanks for the hard work by the way!

from blendid.

greypants avatar greypants commented on August 19, 2024

Oooohh... it's a plugin, not a transform. Got it. Looks good! I should add that to mine as well. I'll open an issue to support plugins from the config.

from blendid.

yilativ avatar yilativ commented on August 19, 2024

Awesome!! Thank you kind sir!

from blendid.

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.