Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

Compilation is always succesful when it should not be #94

Open
sandervspl opened this issue Jun 27, 2019 · 1 comment
Open

Compilation is always succesful when it should not be #94

sandervspl opened this issue Jun 27, 2019 · 1 comment

Comments

@sandervspl
Copy link

sandervspl commented Jun 27, 2019

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
Copy link
Collaborator

Seems to be related to #93 ?

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

No branches or pull requests

2 participants