Chrome Debugger - “No Domain” Section Showing Duplicated Paths (after Webpack)

≡放荡痞女 提交于 2019-12-24 11:29:24

问题


I will first include a picture, as it explains the situation the best:

My question is as follows:

The paths circled in red are really odd. Here is an example:

C:/Users/..../Documents/Programming/_actual-programs/html-css-js/github-pages/name.github.io/src/C:/Users/.../Documents/Programming/_actual-programs/html-css-js/github-pages/name.github.io/src/C:/Users/.../Documents/Programming/_actual-programs/html-css-js/github-pages/name.github.io/src/C:/Users/.../Documents/Programming/_actual-programs/html-css-js/github-pages/name.github.io/src/styles.scss

As seen, there are tons of CSS files on the left, under (no domain), and each file has the path repeated multiple times. That does not seem right. I believe it has to do with the source maps for the CSS.

My Webpack setup has sourceMap set to true for every loader that processes CSS (only posting the relevant part):

    {
      test: /\.s?[ac]ss$/,
      exclude: /node_modules/,
      use: [
        isProduction
          ? MiniCssExtractPlugin.loader
          : {
              // creates style nodes from JS strings
              loader: 'style-loader',
              options: {
                sourceMap: true,
                // convertToAbsoluteUrls: true
              }
            },
        {
          // CSS to CommonJS (resolves CSS imports into exported CSS string in JS bundle)
          loader: 'css-loader',
          options: {
            sourceMap: true,
            importLoaders: 3
            // url: false,
            // import: false
          }
        },
        {
          loader: 'postcss-loader',
          options: {
            config: {
              ctx: {
                cssnext: {},
                cssnano: {},
                autoprefixer: {}
              }
            },
            sourceMap: true
          }
        },
        {
          loader: 'resolve-url-loader',
          options: {
            attempts: 1,
            sourceMap: true
          }
        },
        {
          // compiles Sass to CSS
          loader: 'sass-loader',
          options: { sourceMap: true }
        }
      ]
    },

If I set one of the sourceMap properties to false (for instance postcss-loader), the paths are no longer duplicated like above.

But according to the various loader documentations, each loader on the chain, from start to end in the Webpack config, must be set to true for the output to be correct.

Any thoughts on what is going on here would be deeply appreciated.


EDIT:

This question has an open issue here: https://github.com/webpack-contrib/css-loader/issues/652

来源:https://stackoverflow.com/questions/52256634/chrome-debugger-no-domain-section-showing-duplicated-paths-after-webpack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!