question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

plugins/karma.d.ts is not a module

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.2.7
node: 6.11.2
os: linux x64
@angular/animations: 4.3.3
@angular/common: 4.3.3
@angular/compiler: 4.3.3
@angular/core: 4.3.3
@angular/forms: 4.3.3
@angular/http: 4.3.3
@angular/platform-browser: 4.3.3
@angular/platform-browser-dynamic: 4.3.3
@angular/router: 4.3.3
@angular/cli: 1.2.7
@angular/compiler-cli: 4.3.3
@angular/language-service: 4.3.3

Repro steps.

Create new Angular CLI app and convert karma.conf.js to karma.conf.ts Try to import @angular/cli/plugins/karma with

import karmaAngularCli = require('@angular/cli/plugins/karma');

The log given by the failure.

...node_modules/@angular/cli/plugins/karma.d.ts is not a module

Desired functionality.

I’d like to import the Karma plugin this way in my karma.conf.ts because IntelliJ does not understand the use of require in the plugins array.

plugins: [
    ...
    // It wants to import 'require' from another file (./src/test).
    require('@angular/cli/plugins/karma'),
],

Mention any other details that might be useful.

The file ..node_modules/@angular/cli/plugins/karma.d.ts is completely empty, this might be why Typescript does not understand it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rigoletocommented, Aug 7, 2019

If anyone else runs into this, what fixed it for me was to change

    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],

to

    plugins: [
      'karma-jasmine',
      'karma-chrome-launcher',
      'karma-jasmine-html-reporter',
      'karma-coverage-istanbul-reporter',
      '@angular-devkit/build-angular/plugins/karma',
    ],

in karma.conf.js

0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript typings give me "index.d.ts is not a module"
The index.d.ts file indeed is not a module, it just references two other files with interfaces in them. So I thought to remove...
Read more >
heremaps index.d.ts is not a module - Budi Irawan
ts' is not a module. It is because heremaps is a browser library, but I'm using moduleResolution: "node" in my tsconfig.
Read more >
Documentation - Modules .d.ts - TypeScript
Comparing JavaScript to an example DTS. Common CommonJS Patterns. A module using CommonJS patterns uses module.exports to describe the exported values.
Read more >
File is not a module error in TypeScript | bobbyhadz
We used the export keyword to export the sum function. Now we can import it in the index.ts file.
Read more >
TypeScript ES6 import module File is not a module error
I am using TypeScript 1.6 with ES6 modules syntax. My files are: test.ts: module App { export ... ' is not a module....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found