tonyketcham / p5-svelte

Easily add p5 sketches to a Svelte project 🍛 🌱
https://p5-svelte.netlify.app
MIT License
177 stars 7 forks source link

Error: Invalid value "iife" for option "output.format" #285

Open wktdev opened 1 year ago

wktdev commented 1 year ago

Describe the bug I tried to import using NPM and got an error. I deleted the p5 packages and installed pnpm. When I run my svelte app I get the errors below.


[!] Error: Invalid value "iife" for option "output.format" - UMD and IIFE output formats are not supported for code-splitting builds. https://rollupjs.org/guide/en/#outputformat Error: Invalid value "iife" for option "output.format" - UMD and IIFE output formats are not supported for code-splitting builds. at error (/Users/williamturner/Desktop/new_svelte/my-svelte-project/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/rollup.js:198:30) at validateOptionsForMultiChunkOutput (/Users/williamturner/Desktop/new_svelte/my-svelte-project/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/rollup.js:16076:16) at Bundle.generate (/Users/williamturner/Desktop/new_svelte/my-svelte-project/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/rollup.js:15910:17) at processTicksAndRejections (node:internal/process/task_queues:96:5) at /Users/williamturner/Desktop/new_svelte/my-svelte-project/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/rollup.js:23833:27 at catchUnfinishedHookActions (/Users/williamturner/Desktop/new_svelte/my-svelte-project/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/rollup.js:23247:20) at async Promise.all (index 0) at Task.run (/Users/williamturner/Desktop/new_svelte/my-svelte-project/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/watch.js:246:32) at Watcher.run (/Users/williamturner/Desktop/new_svelte/my-svelte-project/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/watch.js:173:13)

jandot commented 1 year ago

Same thing here, I'm afraid.

rhysw97 commented 1 year ago

I seem to have the same error. Hopefully this will get resolved but I think in the meantime I will try using react instead

rhysw97 commented 1 year ago

So I have been looking into this myself and tbh I have found it is really easy to add p5 into a svelte app using the cdn link as a script tag in the index.html file. It will probably also work with npm install but I have yet to try that so tbh you don't even need this package

Treenhan commented 1 year ago

I have the exact same issue, somehow adding the following line helps for now

export default {
    input: 'src/main.ts',
    output: {
        sourcemap: true,
        format: 'iife',
        name: 'app',
        file: 'public/build/bundle.js',
        inlineDynamicImports: true // ADD THIS
    },
919642993 commented 1 year ago