Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not open editor when I click on the error #24

Closed
Yarchick1034 opened this issue Dec 7, 2018 · 3 comments
Closed

Does not open editor when I click on the error #24

Yarchick1034 opened this issue Dec 7, 2018 · 3 comments

Comments

@Yarchick1034
Copy link

Yarchick1034 commented Dec 7, 2018

image

webpack: 4.26.1

/* eslint-disable */
var path = require("path");
var webpack = require("webpack");

var HtmlWebpackPlugin = require("html-webpack-plugin");
var ErrorOverlayPlugin = require("error-overlay-webpack-plugin");
var FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin");
var autoprefixer = require("autoprefixer");

var config = require("./config");

module.exports = {
  mode: "development",
  devtool: "cheap-module-source-map",
  entry: [
    "webpack-dev-server/client?/",
    "webpack/hot/dev-server",
    // require.resolve('react-dev-utils/webpackHotDevClient'),
    // require.resolve('react-error-overlay'),
    "./src/index.js",
  ],
  output: {
    publicPath: "/",
    path: __dirname + "/static/js/",
    filename: "main.js",
  },
  module: {
    rules: [
      {
        test: /\.(html)$/,
        use: {
          loader: "html-loader",
        },
      },
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: [
          "babel-loader",
          {
            loader: "eslint-loader",
            options: {
              emitWarning: true,
            },
          },
        ],
      },
      {
        test: /\.(css|scss)$/,
        use: [
          "style-loader",
          {
            loader: "css-loader",
            options: {
              modules: true,
              sourceMap: true,
              localIdentName: "[local]__[hash:8]",
            },
          },
          {
            loader: "postcss-loader",
            options: {
              plugins: [
                autoprefixer({
                  browsers: ["ie >= 8", "last 4 version"],
                }),
              ],
              sourceMap: true,
            },
          },
          {
            loader: "sass-loader",
            options: {
              sourceMap: true,
            },
          },
        ],
      },
      {
        test: /\.(png|jpg|gif)$/,
        use: [
          {
            loader: "file-loader",
            options: {
              name: "[name].[ext]",
              outputPath: "static/media/",
            },
          },
        ],
      },
    ],
  },
  plugins: [
    new ErrorOverlayPlugin(),
    new FriendlyErrorsWebpackPlugin({
      compilationSuccessInfo: {
        messages: ["You application is running here http://localhost:" + config.port],
        notes: ["^_^ ./"],
      },
      clearConsole: true,
    }),
    new webpack.HotModuleReplacementPlugin(),
    new HtmlWebpackPlugin({
      template: "public/index.html",
    }),
  ],
};
@Yarchick1034 Yarchick1034 changed the title VS Code does not open when I click on the error Does not open editor when I click on the error Dec 7, 2018
@Yarchick1034
Copy link
Author

I found a mistake
I have:
fileName: webpack:///src/components/SomeComponent.js,
right:
fileName: ./src/components/SomeComponent.js

Why i get the wrong address?
Probably I have somewhere incorrectly configured config.

@Yarchick1034
Copy link
Author

I fix this problem.

Need to add this line code for replace original disk location.

output: {
...
devtoolModuleFilenameTemplate: info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')
...
}

@gregberge
Copy link
Owner

Great, thanks for the trick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants