Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix: sanitize rollup-generated filenames (#1648)
Browse files Browse the repository at this point in the history
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
  • Loading branch information
danielroe and pi0 committed Nov 3, 2021
1 parent a62351a commit d30f4d8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/nitro/package.json
Expand Up @@ -50,7 +50,7 @@
"jiti": "^1.12.9",
"listhen": "^0.2.5",
"mime": "^2.5.2",
"mlly": "^0.3.11",
"mlly": "^0.3.12",
"node-fetch": "^3.0.0",
"ohmyfetch": "^0.4.2",
"ora": "^6.0.1",
Expand Down
5 changes: 2 additions & 3 deletions packages/nitro/src/rollup/config.ts
Expand Up @@ -16,6 +16,7 @@ import { visualizer } from 'rollup-plugin-visualizer'
import * as unenv from 'unenv'

import type { Preset } from 'unenv'
import { sanitizeFilePath } from 'mlly'
import { NitroContext } from '../context'
import { resolvePath } from '../utils'
import { pkgDir } from '../dirs'
Expand Down Expand Up @@ -99,9 +100,6 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
} else if (lastModule.includes('assets')) {
prefix = 'assets'
}
if (chunkInfo.name.includes('#')) {
return join('chunks', prefix, chunkInfo.name.replace(/#/g, '-') + '.mjs')
}
return join('chunks', prefix, '[name].mjs')
},
inlineDynamicImports: nitroContext.inlineDynamicImports,
Expand All @@ -110,6 +108,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
intro: '',
outro: '',
preferConst: true,
sanitizeFileName: sanitizeFilePath,
sourcemap: nitroContext.sourceMap,
sourcemapExcludeSources: true,
sourcemapPathTransform (relativePath, sourcemapPath) {
Expand Down
1 change: 1 addition & 0 deletions packages/vite/package.json
Expand Up @@ -28,6 +28,7 @@
"externality": "^0.1.4",
"fs-extra": "^10.0.0",
"magic-string": "^0.25.7",
"mlly": "^0.3.12",
"p-debounce": "^4.0.0",
"pathe": "^0.2.0",
"postcss-import": "^14.0.2",
Expand Down
4 changes: 3 additions & 1 deletion packages/vite/src/vite.ts
Expand Up @@ -4,6 +4,7 @@ import consola from 'consola'
import type { Nuxt } from '@nuxt/kit'
import type { InlineConfig, SSROptions } from 'vite'
import type { Options } from '@vitejs/plugin-vue'
import { sanitizeFilePath } from 'mlly'
import { buildClient } from './client'
import { buildServer } from './server'
import virtual from './plugins/virtual'
Expand Down Expand Up @@ -68,7 +69,8 @@ export async function bundle (nuxt: Nuxt) {
build: {
emptyOutDir: false,
rollupOptions: {
input: resolve(nuxt.options.appDir, 'entry')
input: resolve(nuxt.options.appDir, 'entry'),
output: { sanitizeFileName: sanitizeFilePath }
}
},
plugins: [
Expand Down
10 changes: 9 additions & 1 deletion yarn.lock
Expand Up @@ -2959,7 +2959,7 @@ __metadata:
jiti: ^1.12.9
listhen: ^0.2.5
mime: ^2.5.2
mlly: ^0.3.11
mlly: ^0.3.12
node-fetch: ^3.0.0
ohmyfetch: ^0.4.2
ora: ^6.0.1
Expand Down Expand Up @@ -3128,6 +3128,7 @@ __metadata:
externality: ^0.1.4
fs-extra: ^10.0.0
magic-string: ^0.25.7
mlly: ^0.3.12
p-debounce: ^4.0.0
pathe: ^0.2.0
postcss-import: ^14.0.2
Expand Down Expand Up @@ -13996,6 +13997,13 @@ __metadata:
languageName: node
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":
version: 9.1.3
resolution: "mocha@npm:9.1.3"
Expand Down

0 comments on commit d30f4d8

Please sign in to comment.