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.

SourceMap Support

See original GitHub issue

The stack trace for each command is really useful, it’d be even better if it used sourcemaps. Maybe this library could be of some use? https://github.com/evanw/node-source-map-support I’m not certain, but it may be as simple as including the library and calling install().

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
sebavancommented, Feb 15, 2019

@robertlong, I started to play with it, it is pretty promising. I am currently moving to modules and React. I ll integrate it in first thing after that step as a test of the new archi.

0reactions
prophetwcommented, Mar 2, 2022

Just use the webpack development to build your code and easy to debug

 mode: isProd ? "development" : "development",
optimization: {
            minimize: false,
            // moduleIds: "size",
            // usedExports: true,
            mangleExports: false,
        },

webpack.config.js below

Spector.js/tools/webpack.config.js
var path = require("path");

var MAIN_DIR = path.resolve(__dirname, "../");
var BUILD_DIR = path.resolve(MAIN_DIR, "./dist");
var DEV_DIR = path.resolve(MAIN_DIR, "./.temp");

var buildConfig = function (env) {
    var isProd = env.prod;

    var config = {
        watch: !isProd,
        context: MAIN_DIR,
        entry: [
            "./vendors/ace.js",
            "./vendors/ace-mode-glsl.js",
            "./vendors/ace-theme-monokai.js",
            "./vendors/ace-theme-override.css",
            "./vendors/ace-ext-searchbox.js",
            "./src/spector.ts"
        ],
        output: {
            path: isProd ? BUILD_DIR : DEV_DIR,
            publicPath: "/",
            filename: "spector.bundle.js",
            libraryTarget: "umd",
            library: "SPECTOR",
            umdNamedDefine: true
        },
        optimization: {
            minimize: false,
            // moduleIds: "size",
            // usedExports: true,
            mangleExports: false,
        },
        performance: {
            hints: false
        },
        resolve: {
            extensions: [".ts", ".tsx", ".js", ".css", ".sass"]
        },
        // devtool: false,
        devtool: 'source-map',
        mode: isProd ? "development" : "development",
        module: {
            rules: [{
                test: /\.tsx?$/,
                loader: "ts-loader",
                options: {
                    configFile: "src/tsconfig.json"
                }
            }, {
                test: /\.scss$/,
                use: ["style-loader?insert=html", "css-loader", "sass-loader"]
            }, {
                test: /\.css$/,
                use: ["style-loader?insert=html", "css-loader"]
            }, {
                test: /ace.js$/,
                // use: [ "exports-loader?ace" ]
                loader: "exports-loader",
                options: {
                    type: "commonjs",
                    exports: "ace",
                },
            }, {
                test: /spector.js$/,
                use: ["exports-loader?SPECTOR"]
            }]
        }
    };

    if (!isProd) {
        config.devtool = "nosources-source-map";

        // Source Map Remapping for dev tools.
        config.output.devtoolModuleFilenameTemplate = (info) => {
            info.resourcePath = path.normalize(info.resourcePath);

            console.error(info.resourcePath);

            // if (!path.isAbsolute(info.resourcePath)) {
            //     info.resourcePath = path.join(DEV_DIR, info.resourcePath);
            // }

            return `../${info.resourcePath.replace(/\\/g, "/")}`;
        };
    }
    return config;
}

module.exports = buildConfig;

Read more comments on GitHub >

github_iconTop Results From Across the Web

source-map-support - npm
Source Map Support ... This module provides source map support for stack traces in node via the V8 stack trace API. It uses...
Read more >
Is there source map support for typescript in node / nodemon?
My tsconfig has sourceMap set to true and the *.map.js files are generated. When I execute my transpiled *.js JavaScript files via node...
Read more >
babel-plugin-source-map-support - npm package - Snyk
babel-plugin-source-map-support. v2.2.0. A Babel plugin which automatically makes stack traces source-map aware For more information about how to use this ...
Read more >
usr/lib/azk/node_modules/source-map-support - Gemfury
This module provides source map support for stack traces in node via the V8 stack trace API. It uses the source-map module to...
Read more >
SourceMap - HTTP - MDN Web Docs
The SourceMap HTTP response header links generated code to a source map, enabling the browser to reconstruct the original source and present ...
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