1

Maybe I'm misinterpreting what source maps should do in a Vue app, but shouldn't I get the *.vue file line number where the error is occurring? I always get a refernce to a line number in a vue.runtime.esm.js file. It references the component, but the line number in the component file would be more helpful. Do I need to install additional source map modules?

My vue.config is below:

module.exports = {
  assetsDir: "",
  publicPath: "/",
  css: {
    sourceMap: true,
    loaderOptions: {
      sass: {
        sassOptions: {},
      },
    },
  },
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === "development") {
      config.devtool = "eval-source-map";

      config.output.devtoolModuleFilenameTemplate = (info) =>
        info.resourcePath.match(/^\.\/\S*?\.vue$/)
          ? `webpack-generated:///${info.resourcePath}?${info.hash}`
          : `webpack-yourCode:///${info.resourcePath}`;

      config.output.devtoolFallbackModuleFilenameTemplate =
        "webpack:///[resource-path]?[hash]";
    }
  },
};

This also doesn't work:

  configureWebpack: (config) => {
    config.devtool = "source-map";
  },

enter image description here

1 Answer 1

1

I had to use 'cheap-module-source-map' instead of 'eval-source-map'. In the end it would look like this:

  configureWebpack: (config) => {
    if (process.env.NODE_ENV === "development") {
      config.devtool = "cheap-module-source-map";

      [...]
    }
  },

Sign up to request clarification or add additional context in comments.

1 Comment

I dont know why actually, but im going to have a good weekend because of your tip. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.