vite v4.1.1 building for production…
transforming (841) node_modules\vuetify\lib\components\VCounter\index.mjsnode_modules/js-sha256/src/sha256.js (83:17) Use of eval in “node_modules/js-sha256/src/sha256.js” is strongly discouraged as it poses security risks and may cause issues with minification.
node_modules/js-sha256/src/sha256.js (84:17) Use of eval in “node_modules/js-sha256/src/sha256.js” is strongly discouraged as it poses security risks and may cause issues with minification.
✓ 876 modules transformed.
rendering chunks (12)…[vite:esbuild-transpile] Transform failed with 2 errors:
assets/index-!~{001}~.js:167040:24: ERROR: Top-level await is not available in the configured target environment (“chrome87”, “edge88”, “es2020”, “firefox78”, “safari14” + 2 overrides)
assets/index-!~{001}~.js:167046:18: ERROR: Top-level await is not available in the configured target environment (“chrome87”, “edge88”, “es2020”, “firefox78”, “safari14” + 2 overrides)
Top-level await is not available in the configured target environment (“chrome87”, “edge88”, “es2020”, “firefox78”, “safari14” + 2 overrides)
167044| User is ${authenticated ? "authenticated" : "not authenticated"}
167045| );
167046| const profile = await keycloak.loadUserProfile();
| ^
167047| console.log(profile is ${profile});
167048| localStorage.setItem(“token”, keycloak.token);
error during build:
Error: Transform failed with 2 errors:
assets/index-!~{001}~.js:167040:24: ERROR: Top-level await is not available in the configured target environment (“chrome87”, “edge88”, “es2020”, “firefox78”, “safari14” + 2 overrides)
assets/index-!~{001}~.js:167046:18: ERROR: Top-level await is not available in the configured target environment (“chrome87”, “edge88”, “es2020”, “firefox78”, “safari14” + 2 overrides)
at failureErrorWithLog (C:\sistemas\workspace\bedtech-novo\frontend\node_modules\vite\node_modules\esbuild\lib\main.js:1604:15)
at C:\sistemas\workspace\bedtech-novo\frontend\node_modules\vite\node_modules\esbuild\lib\main.js:837:29
at responseCallbacks. (C:\sistemas\workspace\bedtech-novo\frontend\node_modules\vite\node_modules\esbuild\lib\main.js:701:9)
at handleIncomingPacket (C:\sistemas\workspace\bedtech-novo\frontend\node_modules\vite\node_modules\esbuild\lib\main.js:756:9)
at Socket.readFromStdout (C:\sistemas\workspace\bedtech-novo\frontend\node_modules\vite\node_modules\esbuild\lib\main.js:677:7)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
Pesquisei achei algumas coisas, mas não entendi.
O que pode ser ?
R
rodriguesabner1 like
esses dois aí: await keycloak.... tão sendo chamado fora de um escopo async, parece estar solto no código. Só ajustar eles e GG
G
guilhermebhte
Fiz assim e funcionou
async()=>{try{constauthenticated=awaitkeycloak.init({onLoad:"login-required",});console.log(`Useris${authenticated?"authenticated":"not authenticated"}`);constprofile=awaitkeycloak.loadUserProfile();console.log(`profileis${profile}`);localStorage.setItem("token",keycloak.tokenasstring);localStorage.setItem("refreshToken",keycloak.refreshTokenasstring);localStorage.setItem("user",keycloak.refreshTokenasstring);localStorage.setItem("profile",JSON.stringify(profile));//TokenRefreshsetInterval(()=>{keycloak.updateToken(70).then((refreshed)=>{if(refreshed){console.log("Token refreshed");}else{console.warn("Token not refreshed");}}).catch(()=>{console.error("Failed to refresh token");});},6000);}catch(error){console.error("Failed to initialize adapter:",error);}};
G
guilhermebhte
Local funcionou, mas quando fez o deploy no servidor deu este erro:
mostra o arquivo vite config ou algum lugar q vc botou esse /homologacao aí. Não existe essa pasta…
G
guilhermebhte
R
rodriguesabner1 like
tira esse homologacao aí. O correto é vite build. Isso ta no package.json
R
rodriguesabner1 like
notei que vc tem um --mode homologacao no action do git. Ao invés de tirar, pode trocar também… Aí ficaria:
"build": "tsc && vite build --mode homologacao",
G
guilhermebhte
Agora deu este erro
$ npm run build --mode homologacao
quizme@0.0.1 build
tsc && vite build --mode homologacao homologacao
src/main.ts(1,17): error TS2307: Cannot find module ‘./App.vue’ or its corresponding type declarations.
src/router/MainRoutes.ts(7,27): error TS2307: Cannot find module ‘@/layouts/full/FullLayout.vue’ or its corresponding type declarations.
src/router/MainRoutes.ts(16,31): error TS2307: Cannot find module ‘@/views/dashboards/Analytical.vue’ or its corresponding type declarations.
src/router/MainRoutes.ts(21,31): error TS2307: Cannot find module ‘@/views/apps/analise-tema/AnaliseTema.vue’ or its corresponding type declarations.
src/router/MainRoutes.ts(26,31): error TS2307: Cannot find module ‘@/views/apps/analise-tema/AnaliseTemaPorId.vue’ or its corresponding type declarations.
src/router/MainRoutes.ts(31,31): error TS2307: Cannot find module ‘@/views/apps/tema/Tema.vue’ or its corresponding type declarations.
src/router/MainRoutes.ts(36,31): error TS2307: Cannot find module ‘@/views/apps/tema/TemaPorId.vue’ or its corresponding type declarations.
src/router/MainRoutes.ts(41,31): error TS2307: Cannot find module ‘@/views/apps/tema/Tema.vue’ or its corresponding type declarations.
src/router/index.ts(10,31): error TS2307: Cannot find module ‘@/views/authentication/Error.vue’ or its corresponding type declarations.
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
G
guilhermebhte
Rodou local e o mesmo erro
vi que em todos os arquivos .ts ele criou um arquivo com o mesmo nome com a extensão .js