diff --git a/packages/next/taskfile-webpack.js b/packages/next/taskfile-webpack.js index ea2d9a52f7e28..d018bfdd1df9b 100644 --- a/packages/next/taskfile-webpack.js +++ b/packages/next/taskfile-webpack.js @@ -26,6 +26,13 @@ module.exports = function (task) { }) } + if (stats.hasWarnings()) { + this.emit('plugin_warning', { + plugin: 'taskfile-webpack', + warning: `webpack compiled ${options.name} with warnings:\n${stats.toString('errors-warnings')}`, + }) + } + if (process.env.ANALYZE_STATS) { require('fs').writeFileSync( require('path').join(__dirname, options.name + '-stats.json'), diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index f0e3cae30b9cf..bb42c5c5cd8a9 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -2120,7 +2120,12 @@ export async function ncc_ws(task, opts) { externals['path-to-regexp'] = 'next/dist/compiled/path-to-regexp' export async function path_to_regexp(task, opts) { await task - .source(relative(__dirname, require.resolve('path-to-regexp'))) + .source( + join( + dirname(relative(__dirname, require.resolve('path-to-regexp'))), + '*.{js,map}' + ) + ) .target('dist/compiled/path-to-regexp') }