Skip to content

Commit

Permalink
fix: some file are not generated while using @vitejs/plugin-legacy (fix
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed Aug 30, 2021
1 parent 96712ad commit fcf446d
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions packages/vite/src/node/plugins/css.ts
Expand Up @@ -53,10 +53,10 @@ export interface CSSOptions {
modules?: CSSModulesOptions | false
preprocessorOptions?: Record<string, any>
postcss?:
| string
| (Postcss.ProcessOptions & {
plugins?: Postcss.Plugin[]
})
| string
| (Postcss.ProcessOptions & {
plugins?: Postcss.Plugin[]
})
}

export interface CSSModulesOptions {
Expand All @@ -68,18 +68,18 @@ export interface CSSModulesOptions {
scopeBehaviour?: 'global' | 'local'
globalModulePaths?: RegExp[]
generateScopedName?:
| string
| ((name: string, filename: string, css: string) => string)
| string
| ((name: string, filename: string, css: string) => string)
hashPrefix?: string
/**
* default: null
*/
localsConvention?:
| 'camelCase'
| 'camelCaseOnly'
| 'dashes'
| 'dashesOnly'
| null
| 'camelCase'
| 'camelCaseOnly'
| 'dashes'
| 'dashesOnly'
| null
}

const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`
Expand Down Expand Up @@ -215,10 +215,10 @@ export function cssPlugin(config: ResolvedConfig): Plugin {
isCSSRequest(file)
? moduleGraph.createFileOnlyEntry(file)
: await moduleGraph.ensureEntryFromUrl(
(
await fileToUrl(file, config, this)
).replace(config.base, '/')
)
(
await fileToUrl(file, config, this)
).replace(config.base, '/')
)
)
}
moduleGraph.updateModuleInfo(
Expand Down Expand Up @@ -403,6 +403,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
)
} else if (!config.build.ssr) {
// legacy build, inline css
pureCssChunks.delete(chunk.fileName)
chunkCSS = await processChunkCSS(chunkCSS, {
inlined: true,
minify: true
Expand Down

0 comments on commit fcf446d

Please sign in to comment.