Allow explicitly specifying entryId when multiple entries exist#404
Open
adonig wants to merge 1 commit intomaster-co:rcfrom
Open
Allow explicitly specifying entryId when multiple entries exist#404adonig wants to merge 1 commit intomaster-co:rcfrom
adonig wants to merge 1 commit intomaster-co:rcfrom
Conversation
|
@adonig is attempting to deploy a commit to the Aoyue Team on Vercel. A member of the Team first needs to authorize it. |
Member
|
This is a good strategy. Here's an unpublished reference: import type { Pattern } from 'fast-glob'
import { Options as ExtractorOptions } from '@master/css-extractor'
/* The default options */
const options: PluginOptions = {
mode: 'runtime',
config: 'master.css',
injectNormalCSS: true,
injectRuntime: true,
injectVirtualModule: true,
avoidFOUC: true,
}
export default options
export interface PluginOptions {
/**
* Defines how Master CSS should be integrated into the build.
*
* - `'runtime'`: Detects the application's entry file, automatically injects the initialization of CSSRuntime, and imports the config code.
* - `'extract'`: Detects the application's entry file, automatically imports the `virtual:master.css` module, and triggers the static extraction workflow.
* - `'pre-render'`: Renders all `*.html` dependencies and injects CSS internally. This mode may be integrated with other SSR capabilities.
* - `'progressive'`: Combines `'runtime'` and `'pre-render'` modes.
* - `null`: Disables automatic integration
*/
mode?: 'runtime' | 'extract' | 'progressive' | 'pre-render' | null
/**
* Glob pattern(s) or extractor options for the static extraction mode
*
* - Provide a glob `Pattern` to manually specify your extractor config.
* - Or provide `ExtractorOptions` for fine-grained extractor configuration.
*/
extractor?: ExtractorOptions | Pattern
/**
* Path to the Master CSS config file.
* Defaults to `'master.css'`.
*/
config?: string
/**
* Whether to inject the `@master/normal.css` module into the entry file.
*/
injectNormalCSS?: boolean
/**
* Whether to include Master CSS’s runtime engine into the entry file.
*/
injectRuntime?: boolean
/**
* Whether to register the virtual module `virtual:master.css`.
* Allows importing it directly in user code for dynamic injection.
*/
injectVirtualModule?: boolean
/**
* Prevents Flash of Unstyled Content (FOUC) during the initial render.
* Useful in Runtime
*/
avoidFOUC?: boolean
}Perhaps we just need to disable automatic injection and let developers import the modules manually as they normally would. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In Vite projects where both
src/main.tsx(used for vite serve) andsrc/index.ts(used for vite build) exist, the MasterCSS Vite plugin currently always pickssrc/index.tsas the entry due to glob ordering (alphabetical by default).Solution
This PR introduces a new
entryIdoption for themasterCSS()plugin. It allows users to explicitly define the desired entry point:Usage
No breaking changes. If
entryIdis not provided, the plugin behavior remains unchanged.