chibat / chrome-extension-typescript-starter

Chrome Extension TypeScript Starter
MIT License
2.39k stars 403 forks source link

Awesome project, Im just not being able to debug from typescript on vscode #19

Open Ortega-Dan opened 4 years ago

Ortega-Dan commented 4 years ago

Sorry it is possibly lack of knowledge from my end ...

but I was able to port a chrome extension I had ... everything is working fine, but Im not able to debug from vscode ...

I know I need the sourcemaps for it so I change the tsconfig to

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es6",
        "noImplicitAny": false,
        "sourceMap": true, // <--------------- here the change
        "rootDir": "src",
        "outDir": "dist/js",
        "noEmitOnError": true,
        "typeRoots": [
            "node_modules/@types"
        ]
    }
}

but if I compile it like that (with tsc) it gives me the runtime error: Uncaught ReferenceError: exports is not defined ...

I know that can be related to the module in the tsconfig.json ... but if i change it from

    "module": "commonjs",

to

    "module": "umd",   // or "amd"

it then doesnt find a chain of dependencies ... starting from "moment" ...


and if (instead of all that) I do "npm run build" it doesnt create the sourceMaps in order to debug from typescript ...

I will appreciate so much your help ....