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

The compilation has terminated with an unexpected error. #210

Open
Zamiell opened this issue Apr 1, 2020 · 2 comments
Open

The compilation has terminated with an unexpected error. #210

Zamiell opened this issue Apr 1, 2020 · 2 comments
Labels
question Further information is requested

Comments

@Zamiell
Copy link

Zamiell commented Apr 1, 2020

Zamiell@computer js % npx tscc --debug
TSCC: TypeError: Cannot read property 'map' of undefined
    at transformBundle (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:70027:53)
    at transformSourceFileOrBundle (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:70022:24)
    at transformation (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:85827:24)
    at transformRoot (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:85847:82)
    at Object.map (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:507:29)
    at Object.transformNodes (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:85834:30)
    at emitJsFileOrBundle (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:86340:32)
    at emitSourceFileOrBundle (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:86293:13)
    at forEachEmittedFile (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:86073:34)
    at Object.emitFiles (/Users/Zamiell/Repositories/hanabi-live/public/js/node_modules/@tscc/tscc/node_modules/typescript/lib/typescript.js:86274:9)

For reference, the error happens at the following code, e.g. typescript.js:70027:

        function transformBundle(node) {
            return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
                if (prepend.kind === 288 /* InputFiles */) {
                    return ts.createUnparsedSourceFile(prepend, "js");
                }
                return prepend;
            }));
        }

My tsconfig:

{
    "compilerOptions": {
        "downlevelIteration": true,
        "importHelpers": true, // Not necessary since TSCC forces it, but oh well
        "module": "commonjs", // Not necessary since TSCC forces it, but oh well
    },

    "include": [
        "./src/**/*.ts",
    ],
}

My tscc.spec.json:

{
    "modules": {
        "out": "src/main.ts"
    }
}
  1. The --debug command seems to do nothing.
  2. The error message is pretty unhelpful

Any tips?

@mattrenaud
Copy link

@Zamiell Had the same issue when i ran it through npx. Installing it globally fixed it: npm i -g @tscc/tscc then running tscc instead.

@theseanl
Copy link
Owner

If npx fixes it, it could be due to typescript version mismatch. Also, as I recall the transformBundle code path should not be taken for projects fed to tsickle. If there are some files that are not 'modules', i.e. without export or import statements, try making those into modules. In any case a minimal reproduction case would be helpful.

@theseanl theseanl added the question Further information is requested label Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants