最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

google chrome extension - Typescript doesn't imports the file - Stack Overflow

programmeradmin1浏览0评论

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 });
发布评论

评论列表(0)

  1. 暂无评论