@@ -8,7 +8,6 @@ import * as vite from 'vite';
8
8
import { load_config } from './core/config/index.js' ;
9
9
import { networkInterfaces , release } from 'os' ;
10
10
import { coalesce_to_error } from './utils/error.js' ;
11
- import { logger } from './core/utils.js' ;
12
11
13
12
/** @param {unknown } e */
14
13
function handle_error ( e ) {
@@ -158,31 +157,18 @@ prog
158
157
. action ( async ( { verbose } ) => {
159
158
try {
160
159
process . env . NODE_ENV = process . env . NODE_ENV || 'production' ;
161
- const config = await load_config ( ) ;
162
-
163
- const log = logger ( { verbose } ) ;
164
-
165
- const { build } = await import ( './core/build/index.js' ) ;
166
- const { build_data, prerendered } = await build ( config , { log } ) ;
167
-
168
- console . log (
169
- `\nRun ${ colors . bold ( ) . cyan ( 'npm run preview' ) } to preview your production build locally.`
170
- ) ;
171
-
172
- if ( config . kit . adapter ) {
173
- const { adapt } = await import ( './core/adapt/index.js' ) ;
174
- await adapt ( config , build_data , prerendered , { log } ) ;
160
+ process . env . VERBOSE = verbose ;
175
161
176
- // this is necessary to close any open db connections, etc
177
- process . exit ( 0 ) ;
178
- }
162
+ const svelte_config = await load_config ( ) ;
163
+ const { plugins } = await import ( './vite/plugin.js' ) ;
164
+ const vite_config = await svelte_config . kit . vite ( ) ;
179
165
180
- console . log ( colors . bold ( ) . yellow ( '\nNo adapter specified' ) ) ;
166
+ /** @type {import('vite').UserConfig } */
167
+ const config = {
168
+ plugins : [ ...( vite_config . plugins || [ ] ) , await plugins ( svelte_config ) ]
169
+ } ;
181
170
182
- // prettier-ignore
183
- console . log (
184
- `See ${ colors . bold ( ) . cyan ( 'https://kit.svelte.dev/docs/adapters' ) } to learn how to configure your app to run on the platform of your choosing`
185
- ) ;
171
+ await vite . build ( config ) ;
186
172
} catch ( error ) {
187
173
handle_error ( error ) ;
188
174
}
0 commit comments