Main package should be compiled for node env
See original GitHub issueI had an issue with the axios library when I was using axios in the main package, the code was resolving to the XHR adapter. It was happening due to this field in package.json of axios:
"browser": {
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
},
It means that for browser env ./lib/adapters/http.js
file should be replaced with ./lib/adapters/xhr.js
, but main package is running under node environment, and it was causing the error. Here is the more detailed issue https://github.com/vitejs/vite/issues/6382 .
So, I fixed it with ssr: true
in the build section of config.vite.js. What do you think about this? I can provide PR if you want 🙂
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Environment variables in Node.js. The Right way!
This is my first blog post. Hope y'all like it . Environment variables are very fundamental part of developing with Node.js or any...
Read more >node.js - How to put .env and other filed in dist folder while ...
To resolve this issue, I need to copy my all the configuration/static files (here, .env file) into ./dist folder at the time of...
Read more >Best Practices for Node.js Development - Heroku Dev Center
A list of tips and techniques to keep you and your Node apps happy.
Read more >Modules: Packages | Node.js v19.3.0 Documentation
Introduction#. A package is a folder tree described by a package.json file. The package consists of the folder containing the package.json file and...
Read more >Best practices for creating a modern npm package - Snyk
In this tutorial, we're going to walk step by step through creating an npm package using modern best practices (as of 2022).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems build in
ssr: true
works fine formain
andpreload
. But I can’t dare use it because SSR support is still experimental.You may be right. But I need more tests and research for that change