Skip to content

Importing an invalid URL breaks chunk loading #802

Open
@rikbrowning

Description

@rikbrowning
  • Operating System: Windows 10
  • Node Version: 14.15.0
  • NPM Version: 7.20.0
  • webpack Version: 5.48.0
  • mini-css-extract-plugin Version: 2.2.0

Expected Behavior

Having an invalid import in my SCSS should not break the loading of other Chunks. This worked when using webpack v4.

Actual Behavior

You get an error in the console and the chunks don't load.
image

Code

// webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
    mode:"production",
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  },
  module: {
    rules: [
      {
        test: /\.s[ac]ss$/i,
        use: [
            MiniCssExtractPlugin.loader,
          "css-loader",
          "sass-loader",
        ],
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin(),
    new MiniCssExtractPlugin({
      // Options similar to the same options in webpackOptions.output
      // both options are optional
      filename: "[name].css",
      chunkFilename: "[id].css",
    }),
  ],
};

How Do We Reproduce?

Put together this repo showcasing the issue: https://github.com/rikbrowning/webpack5-link-issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions