File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,8 @@ import os from 'os';
2
2
import crypto from 'crypto' ;
3
3
4
4
import { SourceMapConsumer } from 'source-map' ;
5
- import { SourceMapSource , RawSource } from 'webpack-sources' ;
6
5
import RequestShortener from 'webpack/lib/RequestShortener' ;
7
- import {
6
+ import webpack , {
8
7
ModuleFilenameHelpers ,
9
8
SourceMapDevToolPlugin ,
10
9
version as webpackVersion ,
@@ -21,6 +20,11 @@ import { minify as minifyFn } from './minify';
21
20
22
21
const warningRegex = / \s .+ : + ( [ 0 - 9 ] + ) : + ( [ 0 - 9 ] + ) / ;
23
22
23
+ // webpack 5 exposes the sources property to ensure the right version of webpack-sources is used
24
+ const { SourceMapSource, RawSource } =
25
+ // eslint-disable-next-line global-require
26
+ webpack . sources || require ( 'webpack-sources' ) ;
27
+
24
28
class CssMinimizerPlugin {
25
29
constructor ( options = { } ) {
26
30
validateOptions ( schema , options , {
You can’t perform that action at this time.
0 commit comments