1
- import fs from 'fs'
2
- import path from 'path'
1
+ import fs from 'node: fs'
2
+ import path from 'node: path'
3
3
import { pathResolve , run } from 'rzpack-utils'
4
4
import { Template } from '.'
5
5
import biomeVscodeSettings from '../template-biome/.vscode/settings.json'
6
- import { JS_LINT , PromptsResult } from './prompts'
6
+ import { BUILDER , JS_LINT , type PromptsResult } from './prompts'
7
7
import { deepMerge , sortDependencies } from './utils'
8
8
9
9
/**
@@ -330,9 +330,23 @@ export const renderReadme = ({
330
330
* @param {PromptsResult } result
331
331
*/
332
332
export const renderConfig = ( result : PromptsResult ) => {
333
- const { projectName, cssScoped, jtsLoader, template, million, imageMini } =
334
- result
333
+ const {
334
+ projectName,
335
+ cssScoped,
336
+ builder,
337
+ jtsLoader,
338
+ template,
339
+ million,
340
+ imageMini,
341
+ } = result
335
342
const isTsTemplate = template === Template . TS
343
+ let importStr = 'import { defineConfig'
344
+ if ( jtsLoader ) {
345
+ importStr += ', JSX_TOOLS'
346
+ }
347
+ if ( builder ) {
348
+ importStr += ', BUILDER'
349
+ }
336
350
337
351
let assets = ' assets: {\n'
338
352
if ( cssScoped ) {
@@ -351,12 +365,12 @@ export const renderConfig = (result: PromptsResult) => {
351
365
const lessVars =
352
366
' lessVars: {\n' + ` file: './src/theme/globalVars.ts',\n` + ' },\n'
353
367
368
+ importStr += ` } from 'rzpack'\n\n`
354
369
fs . writeFileSync (
355
370
path . resolve ( process . env . ROOT , 'rzpack.config.ts' ) ,
356
- `import { defineConfig${
357
- jtsLoader ? ', JSX_TOOLS' : ''
358
- } } from 'rzpack'\n\n` +
371
+ importStr +
359
372
'export default defineConfig({\n' +
373
+ ` ${ builder === BUILDER . RSPACK ? 'builder: BUILDER.RSPACK,\n' : '' } ` +
360
374
`${ hasAssets ? assets : '' } ` +
361
375
' html: {\n' +
362
376
` title: '${ projectName } ',\n` +
0 commit comments