You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got error stated in title due to the different between how Webpack & Vite load env vars.
I managed to solve the problem by updating Vite's config:
import{defineConfig,loadEnv}from'vite';exportdefaultdefineConfig(({ mode })=>{constenv=loadEnv(mode,process.cwd(),'');return{define: {// those two env vars are used by this lib// ref: https://github.com/thlorenz/parse-link-header/blob/f380d3f99de4a5411b2d7f8da6069bb7529cbf4a/index.js#L7'process.env.PARSE_LINK_HEADER_MAXLEN': JSON.stringify(env.PARSE_LINK_HEADER_MAXLEN),'process.env.PARSE_LINK_HEADER_THROW_ON_MAXLEN_EXCEEDED': JSON.stringify(env.PARSE_LINK_HEADER_THROW_ON_MAXLEN_EXCEEDED,),},// ...}
There might be more env vas used in the future, & it's not great to maintain this inside our code. Should there be a note for Vite's users in documentation?
The text was updated successfully, but these errors were encountered:
I got error stated in title due to the different between how Webpack & Vite load env vars.
I managed to solve the problem by updating Vite's config:
Refs:
Related issue #26
#28 also addressed this issue & are resolved in another forked repo, see https://github.com/web3-storage/parse-link-header/blob/490a43ab57f2cb890c924a3705b36da14783f797/README.md?plain=1#L53
There might be more env vas used in the future, & it's not great to maintain this inside our code. Should there be a note for Vite's users in documentation?
The text was updated successfully, but these errors were encountered: