File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 11const glob = require ( "tiny-glob" ) ;
2- const { context } = require ( "esbuild" ) ;
2+ const { build , context } = require ( "esbuild" ) ;
33const { envPlugin } = require ( "./envPlugin" ) ;
44
55( async ( ) => {
66 const entryPoints = await glob ( "./app/javascript/*.*" ) ;
7- const ctx = await context ( {
7+ const options = {
88 entryPoints,
99 bundle : true ,
1010 sourcemap : true ,
1111 outdir : "app/assets/builds" ,
1212 plugins : [ envPlugin ] ,
13- loader : { ".js" : "jsx" } ,
14- } ) ;
13+ loader : { ".js" : "jsx" }
14+ } ;
1515
16- if ( process . argv . some ( ( x ) => x === "--watch" ) ) {
16+ if ( process . argv . some ( ( x ) => x === "--watch" ) ) {
17+ const ctx = await context ( options ) ;
1718 await ctx . watch ( ) ;
19+ console . log ( "Watching for changes..." ) ;
20+ } else {
21+ await build ( options ) ;
22+ console . log ( "Build complete." ) ;
1823 }
19- await ctx . serve ( ) ;
20- } ) ( ) ;
24+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments