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

feat: add failing jose example #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jdachtera
Copy link

Hi @nitedani,

thank you very much for making this plugin.

It's been working really great for me so far, but now I'm trying to use the "jose" jwt library and run into an error during bundling. I've added a simple example to reproduce the problem. Any idea how to fix it? Does it maybe have something to do with native node modules imported by jose (e.g. crypto)?

MacBook-Pro:jose jascha$ pnpm build

> [email protected] build /Users/jascha/dev/vite-plugin-standalone/examples/jose
> rimraf dist && vite build --ssr --mode=production

vite v6.0.0-alpha.18 building SSR bundle for production...
✓ 1 modules transformed.
x Build failed in 36ms
error during build:
TypeError: Cannot read properties of undefined (reading 'length')
    at Object.closeBundle (file:///Users/jascha/dev/vite-plugin-standalone/packages/vite-plugin-standalone/lib/index.js:100:49)
    at Object.handler (file:///Users/jascha/dev/vite-plugin-standalone/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-DXWVQosX.js:63903:19)
    at file:///Users/jascha/dev/vite-plugin-standalone/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19743:40
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Promise.all (index 0)
    at async PluginDriver.hookParallel (file:///Users/jascha/dev/vite-plugin-standalone/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19671:9)
    at async Object.close (file:///Users/jascha/dev/vite-plugin-standalone/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20600:13)
    at async buildEnvironment (file:///Users/jascha/dev/vite-plugin-standalone/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-DXWVQosX.js:63656:13)
    at async CAC.<anonymous> (file:///Users/jascha/dev/vite-plugin-standalone/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/cli.js:874:13)
 ELIFECYCLE  Command failed with exit code 1.
MacBook-Pro:jose jascha$ 

@@ -29,7 +29,7 @@ export const standalone = (options?: StandaloneOptions): Plugin => {
let root = '';
let outDir = '';
let outDirAbs = '';
let rollupEntryFilePaths: string[];
let rollupEntryFilePaths: string[] = [];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, it looks like the error disappears when the array is initialised like that.

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 this pull request may close these issues.

1 participant