Ts-loader: Module build failed: TypeError: Cannot read property 'getProgram' of null

Created on 6 Oct 2019  路  5Comments  路  Source: TypeStrong/ts-loader

my webpack's version is 4.41.0 and ts-loader's version is 6.2.0.It showed the error in my vue peoject.what i should do to deal with the probrem?

Module build failed: TypeError: Cannot read property 'getProgram' of null
at Object.getEmitOutput (/Users/pxl/Documents/mics-ui/node_modules/ts-loader/dist/instances.js:369:41)
at getEmit (/Users/pxl/Documents/mics-ui/node_modules/ts-loader/dist/index.js:275:37)
at successLoader (/Users/pxl/Documents/mics-ui/node_modules/ts-loader/dist/index.js:67:15)
at Object.loader (/Users/pxl/Documents/mics-ui/node_modules/ts-loader/dist/index.js:22:12)

@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./doc/main.ts

wontfix

Most helpful comment

I am facing the same issue. Anyone knows how to fix this?

All 5 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Closing as stale. Please reopen if you'd like to work on this further.

@Tiramisupxl Did you end up fixing this problem?

I am facing the same issue. Anyone knows how to fix this?

I had this error when using ts-loader with HappyPack (this might also apply if you're using thread-loader)

What i did was removed ts-loader from HappyPack but kept it for everything else (e.g. babel)

// webpack config

new HappyPack({
    id: 'babel',
    verbose: false,
    loaders: [
      { loader: 'babel-loader' },
      { loader: 'imports-loader?define=>window.define' }
    ]
}),

... 

module: {
  rules: [
  {
    test: /\.tsx?$/,
    use: ['happypack/loader?id=babel', {
      loader: 'ts-loader',
      options: {
        configFile: require.resolve('../tsconfig.json'),
        allowTsInNodeModules: true,
      }
    }],
  },
}
Was this page helpful?
0 / 5 - 0 ratings