mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 09:25:54 +00:00
fix(nitro): pass sourcemap option through to rollup plugins (#2387)
Co-authored-by: Matteo Rigoni <matteo.rigoni@atoms.studio>
This commit is contained in:
parent
5ae1d05fd6
commit
03f9cfa50b
@ -109,7 +109,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
outro: '',
|
outro: '',
|
||||||
preferConst: true,
|
preferConst: true,
|
||||||
sanitizeFileName: sanitizeFilePath,
|
sanitizeFileName: sanitizeFilePath,
|
||||||
sourcemap: nitroContext.sourceMap,
|
sourcemap: !!nitroContext.sourceMap,
|
||||||
sourcemapExcludeSources: true,
|
sourcemapExcludeSources: true,
|
||||||
sourcemapPathTransform (relativePath, sourcemapPath) {
|
sourcemapPathTransform (relativePath, sourcemapPath) {
|
||||||
return resolve(dirname(sourcemapPath), relativePath)
|
return resolve(dirname(sourcemapPath), relativePath)
|
||||||
@ -149,7 +149,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/replace
|
// https://github.com/rollup/plugins/tree/master/packages/replace
|
||||||
rollupConfig.plugins.push(replace({
|
rollupConfig.plugins.push(replace({
|
||||||
// @ts-ignore https://github.com/rollup/plugins/pull/810
|
sourceMap: !!nitroContext.sourceMap,
|
||||||
preventAssignment: true,
|
preventAssignment: true,
|
||||||
values: {
|
values: {
|
||||||
'process.env.NODE_ENV': nitroContext._nuxt.dev ? '"development"' : '"production"',
|
'process.env.NODE_ENV': nitroContext._nuxt.dev ? '"development"' : '"production"',
|
||||||
@ -172,7 +172,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
// ESBuild
|
// ESBuild
|
||||||
rollupConfig.plugins.push(esbuild({
|
rollupConfig.plugins.push(esbuild({
|
||||||
target: 'es2019',
|
target: 'es2019',
|
||||||
sourceMap: true,
|
sourceMap: !!nitroContext.sourceMap,
|
||||||
...nitroContext.esbuild?.options
|
...nitroContext.esbuild?.options
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -298,6 +298,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
||||||
rollupConfig.plugins.push(commonjs({
|
rollupConfig.plugins.push(commonjs({
|
||||||
|
sourceMap: !!nitroContext.sourceMap,
|
||||||
esmExternals: id => !id.startsWith('unenv/'),
|
esmExternals: id => !id.startsWith('unenv/'),
|
||||||
requireReturnsDefault: 'auto'
|
requireReturnsDefault: 'auto'
|
||||||
}))
|
}))
|
||||||
@ -306,7 +307,12 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
rollupConfig.plugins.push(json())
|
rollupConfig.plugins.push(json())
|
||||||
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/inject
|
// https://github.com/rollup/plugins/tree/master/packages/inject
|
||||||
rollupConfig.plugins.push(inject(env.inject))
|
rollupConfig.plugins.push(inject({
|
||||||
|
// TODO: https://github.com/rollup/plugins/pull/1066
|
||||||
|
// @ts-ignore
|
||||||
|
sourceMap: !!nitroContext.sourceMap,
|
||||||
|
...env.inject
|
||||||
|
}))
|
||||||
|
|
||||||
// https://github.com/TrySound/rollup-plugin-terser
|
// https://github.com/TrySound/rollup-plugin-terser
|
||||||
// https://github.com/terser/terser#minify-nitroContext
|
// https://github.com/terser/terser#minify-nitroContext
|
||||||
|
Loading…
Reference in New Issue
Block a user