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
We're building a Vite Lib using React (using Javascript, not Typescript). For business reasons, the lib must be imported using a URL rather than a NPM package.
One of the consumers of the library is an application built on React/Webpack and Typescript using module: 'commonjs'. Our lib should not be bundled, and should only load at runtime, so we advise webpackIgnore magic comments in the import:
The above works in a js/webpack example app, however, our consumers devs are struggling as their app is using Typescript with module: 'commonjs'. The lib loads when tsconfig is change from module: 'commonjs' to module: 'es2020', but it is a huge monolith and they are unwilling to make this change. I suspect we'll have other consumers with the same issue, so would be great if we could handle this somehow through the library.
Does anyone have any suggestions on how to handle this better?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We're building a Vite Lib using React (using Javascript, not Typescript). For business reasons, the lib must be imported using a URL rather than a NPM package.
One of the consumers of the library is an application built on React/Webpack and Typescript using
module: 'commonjs'
. Our lib should not be bundled, and should only load at runtime, so we advisewebpackIgnore
magic comments in the import:The above works in a js/webpack example app, however, our consumers devs are struggling as their app is using Typescript with
module: 'commonjs'
. The lib loads when tsconfig is change frommodule: 'commonjs'
tomodule: 'es2020'
, but it is a huge monolith and they are unwilling to make this change. I suspect we'll have other consumers with the same issue, so would be great if we could handle this somehow through the library.Does anyone have any suggestions on how to handle this better?
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions