[ci] yarn format
This commit is contained in:
parent
0ce86dfdf3
commit
6abea78ecd
2 changed files with 6 additions and 13 deletions
|
@ -73,7 +73,7 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin {
|
|||
delete viteCSSPost.generateBundle;
|
||||
|
||||
// Move our plugin to be right before this one.
|
||||
const ourIndex = plugins.findIndex(p => p.name === PLUGIN_NAME);
|
||||
const ourIndex = plugins.findIndex((p) => p.name === PLUGIN_NAME);
|
||||
const ourPlugin = plugins[ourIndex];
|
||||
|
||||
// Remove us from where we are now and place us right before the viteCSSPost plugin
|
||||
|
@ -147,22 +147,17 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin {
|
|||
|
||||
// Delete CSS chunks so JS is not produced for them.
|
||||
generateBundle(opts, bundle) {
|
||||
if(pureCSSChunks.size) {
|
||||
if (pureCSSChunks.size) {
|
||||
const pureChunkFilenames = new Set([...pureCSSChunks].map((chunk) => chunk.fileName));
|
||||
const emptyChunkFiles = [...pureChunkFilenames]
|
||||
.map((file) => path.basename(file))
|
||||
.join('|')
|
||||
.replace(/\./g, '\\.')
|
||||
const emptyChunkRE = new RegExp(
|
||||
opts.format === 'es'
|
||||
? `\\bimport\\s*"[^"]*(?:${emptyChunkFiles})";\n?`
|
||||
: `\\brequire\\(\\s*"[^"]*(?:${emptyChunkFiles})"\\);\n?`,
|
||||
'g'
|
||||
)
|
||||
.replace(/\./g, '\\.');
|
||||
const emptyChunkRE = new RegExp(opts.format === 'es' ? `\\bimport\\s*"[^"]*(?:${emptyChunkFiles})";\n?` : `\\brequire\\(\\s*"[^"]*(?:${emptyChunkFiles})"\\);\n?`, 'g');
|
||||
|
||||
for (const [chunkId, chunk] of Object.entries(bundle)) {
|
||||
if (chunk.type === 'chunk') {
|
||||
if(pureCSSChunks.has(chunk)) {
|
||||
if (pureCSSChunks.has(chunk)) {
|
||||
// Delete pure CSS chunks, these are JavaScript chunks that only import
|
||||
// other CSS files, so are empty at the end of bundling.
|
||||
delete bundle[chunkId];
|
||||
|
@ -178,8 +173,6 @@ export function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { expect } from 'chai';
|
|||
import cheerio from 'cheerio';
|
||||
import { loadFixture } from './test-utils.js';
|
||||
|
||||
describe('Styles SSR', function() {
|
||||
describe('Styles SSR', function () {
|
||||
this.timeout(5000);
|
||||
|
||||
let fixture;
|
||||
|
|
Loading…
Reference in a new issue