首页 > 解决方案 > 如何从 webpack 中获取完整的错误消息?

问题描述

我正在尝试使用 webpack 来自动添加前缀/编译我的 scss。这是我的 webpack.config.js(基本上是 bootstrap 的复制/粘贴):

const path = require('path');

module.exports = {
  entry: './src/app.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  module: {
    rules: [
      {
        test: /\.(scss)$/,
        use: [
          {
            // Adds CSS to the DOM by injecting a `<style>` tag
            loader: 'style-loader'
          },
          {
            // Interprets `@import` and `url()` like `import/require()` and will resolve them
            loader: 'css-loader'
          },
          {
            // Loader for webpack to process CSS with PostCSS
            loader: 'postcss-loader',
            options: {
              plugins: function () {
                return [
                    // require('precss'),
                    require('autoprefixer')
                ];
              }
            }
          },
          {
            // Loads a SASS/SCSS file and compiles it to CSS
            loader: 'sass-loader'
          }
        ]
      }
    ]
  }
};

但是,如果我有一个未定义的变量或其他一些错误,我得到的唯一细节wp -w

0:0 错误模块构建失败(来自 ./node_modules/sass-loader/lib/loader.js):

这并没有告诉我任何事情。我想知道错误的文件和行号、数量和类型。

编辑:我看了看,wp --help我尝试过--debug--log-level debug但都没有让我到达我想要的地方。

标签: webpack

解决方案


推荐阅读