geowarin / friendly-errors-webpack-plugin

Recognizes certain classes of webpack errors and cleans, aggregates and prioritizes them to provide a better Developer Experience.
MIT License
749 stars 77 forks source link

Compilation is always succesful when it should not be #94

Open sandervspl opened 5 years ago

sandervspl commented 5 years ago

For some reason my errors or warnings are not shown, and the compilation is always succesful. I use webpack-dev-server and webpack-merge to merge two webpack configs.

Edit: Also tried with a project that uses webpack-hot-middleware and webpack-dev-middleware. There it also always compiles succesfully and does not log eslint or build errors.

base:

const baseConfig = {
  mode: 'production',
  output: {
    filename: 'static/js/[name].[hash].js',
    path: paths.resolveRoot('dist'),
    publicPath: '/',
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        options: {
          cacheDirectory: true,
        },
      },
      {
        test: /\.css$/,
        loader: 'style-loader!css-loader',
      },
      {
        test: /\.svg$/,
        oneOf: [
          {
            resourceQuery: /external/,
            loader: 'url-loader',
            options: {
              limit: 10000,
            },
          },
          {
            loader: '@svgr/webpack',
          },
        ],
      },
      {
        test: /\.(jpe?g|png|gif)$/i,
        oneOf: [
          {
            resourceQuery: /external/,
            loader: 'file-loader',
            options: {
              name: 'static/[name].[ext]',
            },
          },
          {
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: 'static/images/[hash].[ext]',
            },
          },
        ],
      },
      {
        exclude: [
          /\.jsx?$/,
          /\.css$/,
          /\.svg$/,
          /\.(jpe?g|png|gif)$/i,
          /\.json$/,
          /\.html$/,
          /\.ejs$/,
        ],
        loader: 'file-loader',
        options: { name: 'static/[name].[ext]' },
      },
    ],
  },
  plugins: [
    new CopyWebpackPlugin(['./public']),
    new HtmlWebpackPlugin({
      template: paths.resolveSrc('template.ejs'),
      filename: 'index.html',
      chunksSortMode: 'none',
    }),
  ],
  optimization: {
    splitChunks: {
      cacheGroups: {
        commons: {
          test: /[\\/]node_modules[\\/]/,
          name: 'vendor',
          chunks: 'all',
        },
      },
    },
  },
  resolve: {
    extensions: ['*', '.js', '.jsx'],
    alias: {
      app: paths.resolveSrc(),
      common: paths.resolveSrc('components/common'),
      components: paths.resolveSrc('components'),
      config: paths.resolveSrc('config'),
      ducks: paths.resolveSrc('ducks'),
      fonts: paths.resolveSrc('static/fonts'),
      images: paths.resolveSrc('static/images'),
      modules: paths.resolveSrc('components/modules'),
      services: paths.resolveSrc('services'),
      styles: paths.resolveSrc('styles'),
      vectors: paths.resolveSrc('static/vectors'),
    },
  },
};

dev config:

const devConfig = {
  mode: 'development',
  devtool: 'eval-source-map',
  entry: {
    app: ['@babel/polyfill', paths.resolveSrc()],
  },
  devServer: {
    host: '0.0.0.0',
    port: process.env.PORT || 3001,
    hot: true,
    historyApiFallback: true,
    quiet: true,
    compress: true,
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.DefinePlugin(globals),
    new FriendlyErrorsWebpackPlugin({
      compilationSuccessInfo: {
        messages: ['Application is running on http://localhost:3000'],
      },
    }),
  ],
};
christophehurpeau commented 5 years ago

Seems to be related to #93 ?