Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import os from 'os';
import crypto from 'crypto';

import { SourceMapConsumer } from 'source-map';
import { SourceMapSource, RawSource } from 'webpack-sources';
import RequestShortener from 'webpack/lib/RequestShortener';
import {
import webpack, {
ModuleFilenameHelpers,
SourceMapDevToolPlugin,
version as webpackVersion,
Expand All @@ -21,6 +20,11 @@ import { minify as minifyFn } from './minify';

const warningRegex = /\s.+:+([0-9]+):+([0-9]+)/;

// webpack 5 exposes the sources property to ensure the right version of webpack-sources is used
const { SourceMapSource, RawSource } =
// eslint-disable-next-line global-require
webpack.sources || require('webpack-sources');

class CssMinimizerPlugin {
constructor(options = {}) {
validateOptions(schema, options, {
Expand Down