source: imaps-frontend/node_modules/vite/index.cjs@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/* eslint-disable no-restricted-globals */
2
3warnCjsUsage()
4
5// type utils
6module.exports.defineConfig = (config) => config
7
8// proxy cjs utils (sync functions)
9// eslint-disable-next-line n/no-missing-require -- will be generated by build
10Object.assign(module.exports, require('./dist/node-cjs/publicUtils.cjs'))
11
12// async functions, can be redirect from ESM build
13const asyncFunctions = [
14 'build',
15 'createServer',
16 'preview',
17 'transformWithEsbuild',
18 'resolveConfig',
19 'optimizeDeps',
20 'formatPostcssSourceMap',
21 'loadConfigFromFile',
22 'preprocessCSS',
23]
24asyncFunctions.forEach((name) => {
25 module.exports[name] = (...args) =>
26 import('./dist/node/index.js').then((i) => i[name](...args))
27})
28
29function warnCjsUsage() {
30 if (process.env.VITE_CJS_IGNORE_WARNING) return
31 const yellow = (str) => `\u001b[33m${str}\u001b[39m`
32 const log = process.env.VITE_CJS_TRACE ? console.trace : console.warn
33 log(
34 yellow(
35 `The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
36 ),
37 )
38}
Note: See TracBrowser for help on using the repository browser.