File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { defineConfig } from '@rslib/core' ;
22import pkgJson from './package.json' with { type : 'json' } ;
33
4- const fullyMinifiedChunks = / l i n t S t a g e d \. j s $ / ;
4+ const fullyMinifiedChunks = / s t a g e d \. j s $ / ;
55
66export default defineConfig ( {
77 lib : [ { syntax : 'es2023' , dts : true } ] ,
@@ -32,7 +32,8 @@ export default defineConfig({
3232 css : false ,
3333 jsOptions : [
3434 {
35- // Fully minify the bundled lint-staged code to reduce package size.
35+ // Fully minify the staged chunk, including bundled lint-staged code,
36+ // to reduce package size.
3637 include : fullyMinifiedChunks ,
3738 } ,
3839 {
Original file line number Diff line number Diff line change 11import { join } from 'node:path' ;
22import { color } from 'rslog' ;
33import { getConfigState } from '../config.ts' ;
4- import { runSetupCLI } from '../setup/index.ts' ;
5- import { runStagedCLI } from '../staged.ts' ;
64import { insertConfigArg , parseCliArgs } from './args.ts' ;
75
86declare global {
@@ -154,11 +152,19 @@ export async function setupCommands(): Promise<void> {
154152 }
155153
156154 if ( command === 'staged' ) {
155+ const { runStagedCLI } = await import (
156+ /* rspackChunkName: 'staged' */
157+ '../staged.ts'
158+ ) ;
157159 await runStagedCLI ( args . slice ( 1 ) ) ;
158160 return ;
159161 }
160162
161163 if ( command === 'setup' ) {
164+ const { runSetupCLI } = await import (
165+ /* rspackChunkName: 'setup' */
166+ '../setup/index.ts'
167+ ) ;
162168 runSetupCLI ( args . slice ( 1 ) ) ;
163169 return ;
164170 }
Original file line number Diff line number Diff line change 11import { parseArgs } from 'node:util' ;
2+ import lintStaged from 'lint-staged' ;
23import { color } from 'rslog' ;
34import { loadRstackConfig } from './config.ts' ;
45
@@ -70,10 +71,6 @@ export async function runStagedCLI(args: string[]): Promise<void> {
7071 ) ;
7172 }
7273
73- const { default : lintStaged } = await import (
74- /* rspackChunkName: 'lintStaged' */
75- 'lint-staged'
76- ) ;
7774 const success = await lintStaged ( {
7875 allowEmpty : values [ 'allow-empty' ] ?? values . allowEmpty ,
7976 concurrent : values . concurrent === undefined ? undefined : JSON . parse ( values . concurrent ) ,
You can’t perform that action at this time.
0 commit comments