0

I am using AngularJS writen in typescript and SystemJS module builder. My app's main file (app.ts) is located inside Scripts/App.

SytemJS production configuration from gulpfile.js:

gulp.task("deploy", ["ts", "vendorjs", "app-css"], function (done) {
return systemBuild("./Scripts/App/app", "./dist/js/main_" + build + ".min.js");
});

function systemBuild(sourcepath, targetPath, cb) {
var builder = new Builder();

// Collection bundling
builder.config({
    defaultJSExtensions: true,
    map: {
        "ts": "node_modules/plugin-typescript/lib/plugin.js"
    },
    baseURL: "./Scripts",
    transpiler: "ts",
    typescriptOptions: {
        module: "system",
        target: "es5",
        sourceMap: true,
        inlineSourceMap: true,
        inlineSources: true,
        resolveTypings: true,
        emitDecoratorMetadata: true,
        noImplicitAny: true,
        typeCheck: true,                // also accepts "strict"
        tsconfig: true               // also accepts a path
    },
    packages: {
        "app": {
            defaultExtension: "ts"
        }
    }
});

return builder.buildStatic(sourcepath, targetPath, {
    minify: true,
    mangle: true,
    sourceMaps: false,
    sourceMapContents: false,
    globalDefs: { DEBUG: false }
});
}

After running gulp default, I am getting 'Uncaught SyntaxError: Unexpected token <' error. Could anybody tell me what I am doing wrong?

tsiro
  • 2,323
  • 3
  • 24
  • 46
  • 2
    You probably have something that returns a `404` when you're linking a package, causing a document that starts with `<` to be returned instead of the content you want! – Daniel B Sep 13 '18 at 07:38
  • have you looked at the contents of the output? That will probably give you a pretty good idea of where to start troubleshooting... – Claies Sep 13 '18 at 07:38
  • when I open 'main.min.js' file where the error occurs in the chrome inspector contains index.html file...pretty weird..suppose my builder config is not properly set up.. – tsiro Sep 13 '18 at 07:42

0 Answers0