hydrogen
hydrogen copied to clipboard
cli-hydrogen overwrites vite customLogger
What is the location of your example repository?
n/a
Which package or tool is having this issue?
CLI
What version of that package or tool are you using?
8.1.1
What version of Remix are you using?
2.9.2
Steps to Reproduce
- Add
const logger = createLogger();
const loggerWarn = logger.warn;
logger.warn = (msg, options) => {
console.log('customLogger.warn has been run')
if (msg.includes('message I want to ignore')) return;
loggerWarn(msg, options);
};
to vite.config.ts
- Introduce code that vite would warn about
Expected Behavior
customLogger.warn has been run is outputted to console
I expect vite customLogger to work as described on vite docs
Actual Behavior
customLogger.warn has been run never is outputted
This occurs because this line overwrites the customLogger that was defined in vite.config.ts.
I suggest only defining customLogger parameter for vite.createServer() if process.env.SHOPIFY_UNIT_TEST is true, so a non customized logger is not passed otherwise