1- import path from 'path'
1+ import { createRequire } from 'node:module'
2+ import path from 'node:path'
23
34import execa from 'execa'
45import fs from 'fs-extra'
@@ -89,6 +90,12 @@ export const handler = async ({
8990 side . includes ( 'web' ) && {
9091 title : 'Building Web...' ,
9192 task : async ( ) => {
93+ // Disable the new warning in Vite v5 about the CJS build being deprecated
94+ // so that users don't have to see it when this command is called with --verbose
95+ process . env . VITE_CJS_IGNORE_WARNING = 'true'
96+
97+ const createdRequire = createRequire ( import . meta. url )
98+
9299 // @NOTE : we're using the vite build command here, instead of the
93100 // buildWeb function directly because we want the process.cwd to be
94101 // the web directory, not the root of the project.
@@ -98,12 +105,8 @@ export const handler = async ({
98105 // it could affect other things that run in parallel while building.
99106 // We don't have any parallel tasks right now, but someone might add
100107 // one in the future as a performance optimization.
101- //
102- // Disable the new warning in Vite v5 about the CJS build being deprecated
103- // so that users don't have to see it when this command is called with --verbose
104- process . env . VITE_CJS_IGNORE_WARNING = 'true'
105108 await execa (
106- `node ${ require . resolve (
109+ `node ${ createdRequire . resolve (
107110 '@redmix/vite/bins/rw-vite-build.mjs' ,
108111 ) } --webDir="${ rwjsPaths . web . base } " --verbose=${ verbose } `,
109112 {
0 commit comments