diff --git a/src/processPattern.js b/src/processPattern.js index 1b2f5583..3714a2be 100644 --- a/src/processPattern.js +++ b/src/processPattern.js @@ -98,8 +98,9 @@ export default function processPattern(globalRef, pattern) { if (path.isAbsolute(file.webpackTo)) { if (output === '/') { - // eslint-disable-next-line no-throw-literal - throw '[copy-webpack-plugin] Using older versions of webpack-dev-server, devServer.outputPath must be defined to write to absolute paths'; + throw new Error( + '[copy-webpack-plugin] Using older versions of webpack-dev-server, devServer.outputPath must be defined to write to absolute paths' + ); } file.webpackTo = path.relative(output, file.webpackTo); diff --git a/test/CopyPlugin.test.js b/test/CopyPlugin.test.js index 6b1ab263..6aa85a02 100644 --- a/test/CopyPlugin.test.js +++ b/test/CopyPlugin.test.js @@ -898,8 +898,9 @@ describe('apply function', () => { }), expectedAssetKeys: [], expectedErrors: [ - '[copy-webpack-plugin] Using older versions of webpack-dev-server, devServer.outputPath must be ' + - 'defined to write to absolute paths', + new Error( + '[copy-webpack-plugin] Using older versions of webpack-dev-server, devServer.outputPath must be defined to write to absolute paths' + ), ], patterns: [ {