import path from 'path'; import fs from 'fs'; const appDirectory = fs.realpathSync(process.cwd()); const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath); const publicUrlOrPath = '/'; const moduleFileExtensions = [ 'web.mjs', 'mjs', 'web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'vue', 'scss', ]; const resolveModule = (resolveFn, filePath) => { const extension = moduleFileExtensions.find((e) => fs.existsSync(resolveFn(`${filePath}.${e}`)) ); if (extension) { return resolveFn(`${filePath}.${extension}`); } return resolveFn(`${filePath}.js`); }; export default { appPath: resolveApp('.'), appBuild: resolveApp('dist'), appPublic: resolveApp('public'), appHtml: resolveApp('index.html'), appPublicHtml: resolveApp('public/index.html'), appMockServiceWorkerJs: resolveApp('public/mockServiceWorker.js'), appIndexJs: resolveModule(resolveApp, process.env.APP_INDEX || 'src/index'), appLibraryIndexJs: process.env.BUILD_LIBRARY && process.env.BUILD_LIBRARY !== 'true' && resolveApp(process.env.BUILD_LIBRARY), appPages: resolveApp('src/pages'), appPackageJson: resolveApp('package.json'), appSrc: resolveApp('src'), appSrcvis: resolveApp('src/vis'), appTsConfig: resolveApp('tsconfig.json'), appBundlerConfig: resolveApp('bundler.config.js'), appNodeModules: resolveApp('node_modules'), publicUrlOrPath, };