Set the node engines range to include versions that import.meta.resolve() is unflagged.
Add tests for Vite3, Vite4 and yarn-pnp
Add github action for test
Details
async function importVite() {
/** @type {import('vite')} */
let vite = await importFrom.silent(process.cwd(), 'vite');
try {
vite ??= await import(import.meta.resolve('vite'));
} catch {}
return vite;
}
In other than Yarn PnP, the importFrom.silet() successfully makes an assignment and then skips the next assignment. Yarn PnP seems to fail on the first assignment but works on the second dynamic import. I'll need to test it after the release and yarn dlx vite-bundle-visualizer, but for now, it seems to properly import vite from the executed project when run through yarn in PnP mode. (I have no idea why).
There are precaution to note:
To run vite-bundle-visualizer in a Yarn PnP project, it must be executed only through the project's yarn commands. Examples include:
yarn dlx vite-bundle-visualizer in project
yarn add -D vite-bundle-visualizer && yarn vite-bundle-visualizer in project
Temporary fix #15
List
import.meta.resolve()
is unflagged.Details
In other than Yarn PnP, the
importFrom.silet()
successfully makes an assignment and then skips the next assignment. Yarn PnP seems to fail on the first assignment but works on the second dynamic import. I'll need to test it after the release and yarn dlxvite-bundle-visualizer
, but for now, it seems to properly import vite from the executed project when run through yarn in PnP mode. (I have no idea why).There are precaution to note:
yarn dlx vite-bundle-visualizer
in projectyarn add -D vite-bundle-visualizer && yarn vite-bundle-visualizer
in project