Skip to content

Commit

Permalink
Fix source map loading failure for path-to-regexp (#66242)
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable authored May 27, 2024
1 parent 2022439 commit 6ea265f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/next/taskfile-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
7 changes: 6 additions & 1 deletion packages/next/taskfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}

Expand Down

0 comments on commit 6ea265f

Please sign in to comment.