Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with vite 4 #31

Closed
mikob opened this issue Apr 7, 2023 · 2 comments · May be fixed by #32
Closed

Doesn't work with vite 4 #31

mikob opened this issue Apr 7, 2023 · 2 comments · May be fixed by #32

Comments

@mikob
Copy link

mikob commented Apr 7, 2023

(node:47994) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.              
1535 (Use `node --trace-warnings ...` to show where the warning was created)                                                      
1536 6:28:50 PM [vite] Error when evaluating SSR module /src/vue_app.ts: failed to import "oh-vue-icons/icons"                    
1537                                                                                                                              
1538 6:28:50 PM [vite] Error when evaluating SSR module virtual:@astrojs/vue/app:                                                 
1539                                                                                                                              
1540 6:28:50 PM [vite] Error when evaluating SSR module @astrojs/vue/server.js:                                                   
1541                                                                                                                              
1542  error   Unexpected token 'export'                                                                                           
1543 /home/mikob/workspace/hairgen.ai/astro-new/nebulous-neptune/node_modules/.pnpm/oh-vue-icons@1.0.0-rc3_vue@3.2.47/node_modules
1544 /oh-vue-icons/icons/index.js:2                                                                                               
1545 export * from "./ai";                                                                                                        
1546 ^^^^^^                                                                                                                       
1547                                                                                                                              
1548 SyntaxError: Unexpected token 'export'                                                                                       
1549     at internalCompileFunction (node:internal/vm:73:18)                                                                      
1550     at wrapSafe (node:internal/modules/cjs/loader:1176:20)                                                                   
1551     at Module._compile (node:internal/modules/cjs/loader:1218:27)                                                            
1552     at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)                                                     
1553     at Module.load (node:internal/modules/cjs/loader:1117:32)                                                                
1554     at Module._load (node:internal/modules/cjs/loader:958:12)                                                                
1555     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)                                                 
1556     at ModuleJob.run (node:internal/modules/esm/module_job:194:25)                                                           
1557     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)                                            
1558  error   Unexpected token 'export'                                                                                           
1559 /home/mikob/workspace/hairgen.ai/astro-new/nebulous-neptune/node_modules/.pnpm/oh-vue-icons@1.0.0-rc3_vue@3.2.47/node_modules
1560 /oh-vue-icons/icons/index.js:2                                                                                               
1561 export * from "./ai";                                                                                                        
1562 ^^^^^^                                                                                                                       
1563                                                                                                                              
1564 SyntaxError: Unexpected token 'export'                                                                                       
1565     at internalCompileFunction (node:internal/vm:73:18)                                                                      
1566     at wrapSafe (node:internal/modules/cjs/loader:1176:20)                                                                   
1567     at Module._compile (node:internal/modules/cjs/loader:1218:27)                                                            
1568     at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)                                                     
1569     at Module.load (node:internal/modules/cjs/loader:1117:32)                                                                
1570     at Module._load (node:internal/modules/cjs/loader:958:12)                                                                
1571     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)                                                 
1572     at ModuleJob.run (node:internal/modules/esm/module_job:194:25)                                                           
1573     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) (x2)   
@mikob mikob mentioned this issue Apr 15, 2023
@mikob
Copy link
Author

mikob commented Apr 15, 2023

Actually this seems to have been an issue with pnpm. Added shamefully-hoist=true to .npmrc and now it's working.

@mikob mikob closed this as completed Apr 15, 2023
@courtyenn
Copy link

courtyenn commented Oct 20, 2023

@mikob I am getting this error.. I've tried to add shamefully-hoist=true to my .npmrc but it did not solve it..

*Edit:
My error occurred not due to pnpm, but vite.
The answer is to modify the vite config to exclude oh-vue-icons from ssr bundling.

See: here

vite.config.mjs

ssr: {
      noExternal: ["oh-vue-icons"],
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants