Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Fails when upgrading to typescript >= 3.2.1 #618

Open
basslagter opened this issue Dec 3, 2018 · 13 comments
Open

Fails when upgrading to typescript >= 3.2.1 #618

basslagter opened this issue Dec 3, 2018 · 13 comments

Comments

@basslagter
Copy link

When upgrading to Typescript 3.2.1 I get
"Module build failed: Error: Final loader (./node_modules/awesome-typescript-loader/dist/entry.js) didn't return a Buffer or String"

@dl748
Copy link

dl748 commented Dec 3, 2018

Agreed, I had to roll back to 3.1.6 to get it to compile correctly

@basslagter
Copy link
Author

Same here

@Ky6uk
Copy link

Ky6uk commented Dec 10, 2018

TS v3.2.2 also has an issue.

@basslagter basslagter changed the title Fails when upgrading to typescript 3.2.1 Fails when upgrading to typescript >= 3.2.1 Dec 10, 2018
@basslagter
Copy link
Author

Yepp, just experienced the same

@astorije
Copy link
Contributor

For the record, this is the error we get when building. The Final loader (...) didn't return a Buffer or String error does not show up here as it only shows up on re-builds:

$ yarn build
yarn run v1.7.0
$ webpack --mode development
ℹ 「atl」: Using [email protected] from typescript
ℹ 「atl」: Using tsconfig.json from /.../tsconfig.json
ℹ 「atl」: Checking started in a separate process...
✖ 「atl」: Child process failed to process the request: Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isJsonSourceFile'.
    at Object.cast (/.../node_modules/typescript/lib/typescript.js:1325:22)
    at getTypeOfVariableOrParameterOrPropertyWorker (/.../node_modules/typescript/lib/typescript.js:35591:41)
    at getTypeOfVariableOrParameterOrProperty (/.../node_modules/typescript/lib/typescript.js:35567:48)
    at getTypeOfSymbol (/.../node_modules/typescript/lib/typescript.js:35856:24)
    at resolveESModuleSymbol (/.../node_modules/typescript/lib/typescript.js:32928:36)
    at getTargetOfNamespaceImport (/.../node_modules/typescript/lib/typescript.js:32431:20)
    at getTargetOfAliasDeclaration (/.../node_modules/typescript/lib/typescript.js:32560:28)
    at resolveAlias (/.../node_modules/typescript/lib/typescript.js:32595:30)
    at checkAliasSymbol (/.../node_modules/typescript/lib/typescript.js:55749:26)
    at checkImportBinding (/.../node_modules/typescript/lib/typescript.js:55778:13)
    at checkImportDeclaration (/.../node_modules/typescript/lib/typescript.js:55796:29)
    at checkSourceElement (/.../node_modules/typescript/lib/typescript.js:56151:28)
    at Object.forEach (/.../node_modules/typescript/lib/typescript.js:210:30)
    at checkSourceFileWorker (/.../node_modules/typescript/lib/typescript.js:56305:20)
    at checkSourceFile (/.../node_modules/typescript/lib/typescript.js:56277:13)
    at getDiagnosticsWorker (/.../node_modules/typescript/lib/typescript.js:56352:17)
    at Object.getDiagnostics (/.../node_modules/typescript/lib/typescript.js:56338:24)
    at /.../node_modules/typescript/lib/typescript.js:87001:85
    at runWithCancellationToken (/.../node_modules/typescript/lib/typescript.js:86967:24)
    at getSemanticDiagnosticsForFileNoCache (/.../node_modules/typescript/lib/typescript.js:86990:20)
    at getAndCacheDiagnostics (/.../node_modules/typescript/lib/typescript.js:87238:26)
    at getSemanticDiagnosticsForFile (/.../node_modules/typescript/lib/typescript.js:86987:20)
    at getDiagnosticsHelper (/.../node_modules/typescript/lib/typescript.js:86929:24)
    at Object.getSemanticDiagnostics (/.../node_modules/typescript/lib/typescript.js:86942:20)
    at getSemanticDiagnosticsOfFile (/.../node_modules/typescript/lib/typescript.js:89025:41)
    at Object.getSemanticDiagnosticsOfNextAffectedFile (/.../node_modules/typescript/lib/typescript.js:89187:52)
    at processDiagnostics (/.../node_modules/awesome-typescript-loader/src/checker/runtime.ts:513:22)
    at /.../node_modules/awesome-typescript-loader/src/checker/runtime.ts:613:6
    at Object.send (/.../node_modules/awesome-typescript-loader/src/checker/runtime.ts:49:6)
    at Checker.req (/.../node_modules/awesome-typescript-loader/src/checker/checker.ts:100:15)
Hash: 7ffd5886c56e982a9956
Version: webpack 4.25.1
Time: 13318ms
Built at: 12/14/2018 3:01:18 PM
                           Asset      Size  Chunks             Chunk Names
                      index.html   409 KiB          [emitted]
    main.45e61292c73d720513b1.js  8.74 MiB    main  [emitted]  main
main.45e61292c73d720513b1.js.map  9.65 MiB    main  [emitted]  main
Entrypoint main = main.45e61292c73d720513b1.js main.45e61292c73d720513b1.js.map
[0] ../locale-data/index.js (ignored) 15 bytes {main} [built]
[1] ./lib/locales (ignored) 15 bytes {main} [built]
[2] ./lib/locales (ignored) 15 bytes {main} [built]
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 489 bytes {main} [built]
[./node_modules/webpack/buildin/harmony-module.js] (webpack)/buildin/harmony-module.js 573 bytes {main} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {main} [built]
[./src/index.tsx] 412 bytes {main} [built]
[./src/translations.ts] 45 bytes {main} [built]
    + 960 hidden modules
Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = index.html
    [./node_modules/html-webpack-plugin/lib/loader.js!./views/index.html.tpl] 1.4 KiB {0} [built]
    [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 489 bytes {0} [built]
    [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {0} [built]
        + 3 hidden modules
✨  Done in 14.44s.

Here is the (minimal) Webpack configuration that led to this:

import webpack from 'webpack';

const config: webpack.Configuration = {
  resolve: {
    extensions: ['.js', '.json', '.ts', '.tsx'],
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        exclude: /node_modules/,
        loader: 'awesome-typescript-loader',
      },
    ],
  },
  devtool: 'source-map',
};

export default config;

What tricked us is that even though the output said ✖ 「atl」: Child process failed to process the request, the build did not return a non-zero code, so our CI passed just fine.
It would be very useful if any failure from a child process would fail the build.

@bitworking
Copy link

It works for me with following config (tsconfig.json):

  "awesomeTypescriptLoaderOptions": {
    "useTranspileModule": true
  }

@basslagter
Copy link
Author

basslagter commented Jan 2, 2019

@bitworking what effect does this have on the output?

Also...for me it works on the first compile but fails with HMR whenever I edit a file in development.

@bitworking
Copy link

@basslagter Yes you are right..a live reload doesn't work for me either. I didn't examine the output if there's a difference but from the docs it only uses a fast transpileModule emit mode.

@bitworking
Copy link

@basslagter
Copy link
Author

@bitworking yes, I am also thinking about switching. This package does not seem to be maintained anymore. Thanks!

@Ky6uk
Copy link

Ky6uk commented Jan 9, 2019

That's funny but ts-loader isn't working in my case without this package because of issue #1 in tsconfig-paths-webpack-plugin. So I switched to ts-loader and I'm currently using a-t-l only for proper paths handling by using TsConfigPathsPlugin exported from it. 🤔

@kaimiyang
Copy link

encounter the same problem.

maybe I should be switch ts-loader too.

@smokinjoe
Copy link

@bitworking - this link doesn't work anymore - you wouldn't happen to be able to get a working URL could you?

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

No branches or pull requests

7 participants