mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix: sanitize rollup-generated filenames (#1648)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
parent
a62351af4d
commit
d30f4d86d2
@ -50,7 +50,7 @@
|
|||||||
"jiti": "^1.12.9",
|
"jiti": "^1.12.9",
|
||||||
"listhen": "^0.2.5",
|
"listhen": "^0.2.5",
|
||||||
"mime": "^2.5.2",
|
"mime": "^2.5.2",
|
||||||
"mlly": "^0.3.11",
|
"mlly": "^0.3.12",
|
||||||
"node-fetch": "^3.0.0",
|
"node-fetch": "^3.0.0",
|
||||||
"ohmyfetch": "^0.4.2",
|
"ohmyfetch": "^0.4.2",
|
||||||
"ora": "^6.0.1",
|
"ora": "^6.0.1",
|
||||||
|
@ -16,6 +16,7 @@ import { visualizer } from 'rollup-plugin-visualizer'
|
|||||||
import * as unenv from 'unenv'
|
import * as unenv from 'unenv'
|
||||||
|
|
||||||
import type { Preset } from 'unenv'
|
import type { Preset } from 'unenv'
|
||||||
|
import { sanitizeFilePath } from 'mlly'
|
||||||
import { NitroContext } from '../context'
|
import { NitroContext } from '../context'
|
||||||
import { resolvePath } from '../utils'
|
import { resolvePath } from '../utils'
|
||||||
import { pkgDir } from '../dirs'
|
import { pkgDir } from '../dirs'
|
||||||
@ -99,9 +100,6 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
} else if (lastModule.includes('assets')) {
|
} else if (lastModule.includes('assets')) {
|
||||||
prefix = 'assets'
|
prefix = 'assets'
|
||||||
}
|
}
|
||||||
if (chunkInfo.name.includes('#')) {
|
|
||||||
return join('chunks', prefix, chunkInfo.name.replace(/#/g, '-') + '.mjs')
|
|
||||||
}
|
|
||||||
return join('chunks', prefix, '[name].mjs')
|
return join('chunks', prefix, '[name].mjs')
|
||||||
},
|
},
|
||||||
inlineDynamicImports: nitroContext.inlineDynamicImports,
|
inlineDynamicImports: nitroContext.inlineDynamicImports,
|
||||||
@ -110,6 +108,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
intro: '',
|
intro: '',
|
||||||
outro: '',
|
outro: '',
|
||||||
preferConst: true,
|
preferConst: true,
|
||||||
|
sanitizeFileName: sanitizeFilePath,
|
||||||
sourcemap: nitroContext.sourceMap,
|
sourcemap: nitroContext.sourceMap,
|
||||||
sourcemapExcludeSources: true,
|
sourcemapExcludeSources: true,
|
||||||
sourcemapPathTransform (relativePath, sourcemapPath) {
|
sourcemapPathTransform (relativePath, sourcemapPath) {
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"externality": "^0.1.4",
|
"externality": "^0.1.4",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"magic-string": "^0.25.7",
|
"magic-string": "^0.25.7",
|
||||||
|
"mlly": "^0.3.12",
|
||||||
"p-debounce": "^4.0.0",
|
"p-debounce": "^4.0.0",
|
||||||
"pathe": "^0.2.0",
|
"pathe": "^0.2.0",
|
||||||
"postcss-import": "^14.0.2",
|
"postcss-import": "^14.0.2",
|
||||||
|
@ -4,6 +4,7 @@ import consola from 'consola'
|
|||||||
import type { Nuxt } from '@nuxt/kit'
|
import type { Nuxt } from '@nuxt/kit'
|
||||||
import type { InlineConfig, SSROptions } from 'vite'
|
import type { InlineConfig, SSROptions } from 'vite'
|
||||||
import type { Options } from '@vitejs/plugin-vue'
|
import type { Options } from '@vitejs/plugin-vue'
|
||||||
|
import { sanitizeFilePath } from 'mlly'
|
||||||
import { buildClient } from './client'
|
import { buildClient } from './client'
|
||||||
import { buildServer } from './server'
|
import { buildServer } from './server'
|
||||||
import virtual from './plugins/virtual'
|
import virtual from './plugins/virtual'
|
||||||
@ -68,7 +69,8 @@ export async function bundle (nuxt: Nuxt) {
|
|||||||
build: {
|
build: {
|
||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: resolve(nuxt.options.appDir, 'entry')
|
input: resolve(nuxt.options.appDir, 'entry'),
|
||||||
|
output: { sanitizeFileName: sanitizeFilePath }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
10
yarn.lock
10
yarn.lock
@ -2959,7 +2959,7 @@ __metadata:
|
|||||||
jiti: ^1.12.9
|
jiti: ^1.12.9
|
||||||
listhen: ^0.2.5
|
listhen: ^0.2.5
|
||||||
mime: ^2.5.2
|
mime: ^2.5.2
|
||||||
mlly: ^0.3.11
|
mlly: ^0.3.12
|
||||||
node-fetch: ^3.0.0
|
node-fetch: ^3.0.0
|
||||||
ohmyfetch: ^0.4.2
|
ohmyfetch: ^0.4.2
|
||||||
ora: ^6.0.1
|
ora: ^6.0.1
|
||||||
@ -3128,6 +3128,7 @@ __metadata:
|
|||||||
externality: ^0.1.4
|
externality: ^0.1.4
|
||||||
fs-extra: ^10.0.0
|
fs-extra: ^10.0.0
|
||||||
magic-string: ^0.25.7
|
magic-string: ^0.25.7
|
||||||
|
mlly: ^0.3.12
|
||||||
p-debounce: ^4.0.0
|
p-debounce: ^4.0.0
|
||||||
pathe: ^0.2.0
|
pathe: ^0.2.0
|
||||||
postcss-import: ^14.0.2
|
postcss-import: ^14.0.2
|
||||||
@ -13996,6 +13997,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"mlly@npm:^0.3.12":
|
||||||
|
version: 0.3.12
|
||||||
|
resolution: "mlly@npm:0.3.12"
|
||||||
|
checksum: f9f93622023f4a9adfd27c465ff40146725cbb17176eb3610f4cec73f31edca41dc571030d185406d30044aaa0565a75782ac74a69be3cc58c10fc50505bb74d
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"mocha@npm:^9.1.3":
|
"mocha@npm:^9.1.3":
|
||||||
version: 9.1.3
|
version: 9.1.3
|
||||||
resolution: "mocha@npm:9.1.3"
|
resolution: "mocha@npm:9.1.3"
|
||||||
|
Loading…
Reference in New Issue
Block a user