mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-18 06:31:27 +00:00
perf(nuxt): reduce multiple calls to dirname (#22800)
This commit is contained in:
parent
f06ee59d4a
commit
a70904fd8b
@ -75,11 +75,13 @@ export function ssrStylesPlugin (options: SSRStylePluginOptions): Plugin {
|
|||||||
source: ''
|
source: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const baseDir = dirname(base)
|
||||||
|
|
||||||
emitted[file] = this.emitFile({
|
emitted[file] = this.emitFile({
|
||||||
type: 'asset',
|
type: 'asset',
|
||||||
name: `${filename(file)}-styles.mjs`,
|
name: `${filename(file)}-styles.mjs`,
|
||||||
source: [
|
source: [
|
||||||
...files.map((css, i) => `import style_${i} from './${relative(dirname(base), this.getFileName(css))}';`),
|
...files.map((css, i) => `import style_${i} from './${relative(baseDir, this.getFileName(css))}';`),
|
||||||
`export default [${files.map((_, i) => `style_${i}`).join(', ')}]`
|
`export default [${files.map((_, i) => `style_${i}`).join(', ')}]`
|
||||||
].join('\n')
|
].join('\n')
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user