Grisha_Crysta
Grisha_Crysta

Reputation: 11

Typescript doesn't imports the file

I'm trying to make some chrome extension which needs importing some files but it doesn't do that. Here is the code related to a problem: tsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "lib": ["es2016", "dom", "dom.iterable"],
    "module": "commonjs",
    "rootDir": "src",
    "typeRoots": [ "node_modules/@types" ],
    "resolveJsonModule": true,
    "sourceMap": true,
    "outDir": "dist",
    "noEmitOnError": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true
  }
}

imports.ts

export function hello()
{
    console.log("hello")
}

importer.ts

import * as imports from "./imports"

imports.hello()

Error is

Uncaught ReferenceError: exports is not defined

And line of it is

Object.defineProperty(exports, "__esModule", { value: true });

Upvotes: 1

Views: 31

Answers (0)

Related Questions