vercel / next-plugins

Official Next.js plugins
MIT License
2.68k stars 319 forks source link

devtool option isn't working with useSourceMap #674

Closed ghost closed 3 years ago

ghost commented 4 years ago

Maybe sourceMap of common.js wasn't generated in previous version (#288) So some code(UglifyJsPlugin/TerserPlugin) is added in #296. But in nextjs 9, it seems sourceMap option is no longer needed.

image

Also this two option disturb applying webpack.devtool. For example, I use hidden-source-map for removing sourceMappingURL. But it doesn't work and sourceMappingURL is still alived because of that options.

So how about remove below lines? https://github.com/vercel/next-plugins/blob/097f28aaf4b6f8542bff374ce6ba4d5bdca6cd58/packages/next-source-maps/index.js#L16-L31

ghost commented 4 years ago

@JonAbrams @azizhk @timneutkens How about your thought?

azizhk commented 4 years ago

Hi, I haven't quite followed the recent developments to next, why is sourcemap no longer needed? What changed?

I think you can not use this plugin (remove from your next.config.js) and set devtool in next.config.js's webpack function directly to see if things work out for you. If they do and other devtool options work as well, then I'm fine with removing those lines.

ghost commented 4 years ago

Hello @azizhk

I haven't quite followed the recent developments to next, why is sourcemap no longer needed? What changed?

I don't know about previous version but according to #288 maybe sourcemap of common.js isn't generated. However in nextjs9(my version), I can see sourcemap of common.js is generated well. (Please see my capture)

I think you can not use this plugin (remove from your next.config.js) and set devtool in next.config.js's webpack function directly to see if things work out for you.

Yes so I removed and set webpack config directly as you can see in the capture of the issue. I just want to notice this issue that devtool options isn't working with this plugin :)

timneutkens commented 3 years ago

Closing in favor of https://github.com/vercel/next.js/pull/20267