richardtallent / vite-plugin-singlefile

Vite plugin for inlining JavaScript and CSS resources
MIT License
808 stars 53 forks source link

Invalid value for option "output.inlineDynamicImports" #82

Closed exislow closed 8 months ago

exislow commented 11 months ago

This is a great idea and exactly what I am looking for. Thank you for your effort. But is this plugin still working?

I have issues to get working with my Svelte project: https://github.com/exislow/freeDSP-Aurora-Svelte-Frontend/tree/singlefile

Every time I try to build my project, this happens:

$ npm run build

> sveltekit-bulma-8chan@0.0.1 build
> vite build

9:29:01 PM [vite-plugin-svelte] you are building for production but compilerOptions.dev is true, forcing it to false

vite v4.4.11 building SSR bundle for production...
transforming (1) node_modules/@sveltejs/kit/src/runtime/server/index.js9:29:01 PM [vite-plugin-svelte]

[...]

✓ 97 modules transformed.
Invalid value for option "output.inlineDynamicImports" - multiple inputs are not supported when "output.inlineDynamicImports" is true.
✓ built in 1.37s
error during build:
RollupError: Invalid value for option "output.inlineDynamicImports" - multiple inputs are not supported when "output.inlineDynamicImports" is true.
[...]

I have even followed this tutorial: https://sean.eulenberg.de/posts/single-file-applications-with-svelte/

Do you have any idea whats wrong?

richardtallent commented 9 months ago

Sounds like you're trying to do multiple inputs. Unfortunately, I know nothing about Svelte.

indirectlylit commented 9 months ago

FYI, I get a similar error when trying to use the plugin with VitePress.

Config:

import { defineConfig } from "vitepress";
import { viteSingleFile } from "vite-plugin-singlefile";

export default defineConfig({
  mpa: true, // no JS
  vite: {
    plugins: [viteSingleFile()],
  },
});

Result of built:

  vitepress v1.0.0-rc.25

Invalid value for option "output.inlineDynamicImports" - multiple inputs are not supported when "output.inlineDynamicImports" is true.
✖ building client + server bundles...
build error:
RollupError: Invalid value for option "output.inlineDynamicImports" - multiple inputs are not supported when "output.inlineDynamicImports" is true.
    at error (file:///Users/d/Projects/resume/node_modules/vitepress/node_modules/rollup/dist/es/shared/node-entry.js:2287:30)
    at getInlineDynamicImports (file:///Users/d/Projects/resume/node_modules/vitepress/node_modules/rollup/dist/es/shared/node-entry.js:26497:16)
    at normalizeOutputOptions (file:///Users/d/Projects/resume/node_modules/vitepress/node_modules/rollup/dist/es/shared/node-entry.js:26388:34)
    at getOutputOptions (file:///Users/d/Projects/resume/node_modules/vitepress/node_modules/rollup/dist/es/shared/node-entry.js:26811:12)
    at getOutputOptionsAndPluginDriver (file:///Users/d/Projects/resume/node_modules/vitepress/node_modules/rollup/dist/es/shared/node-entry.js:26806:19)
    at async handleGenerateWrite (file:///Users/d/Projects/resume/node_modules/vitepress/node_modules/rollup/dist/es/shared/node-entry.js:26782:74)
    at async build (file:///Users/d/Projects/resume/node_modules/vitepress/node_modules/vite/dist/node/chunks/dep-68d1a114.js:48085:22)
    at async file:///Users/d/Projects/resume/node_modules/vitepress/dist/node/serve-JefD-RjH.js:48898:20
    at async task (file:///Users/d/Projects/resume/node_modules/vitepress/dist/node/serve-JefD-RjH.js:23985:5)
    at async bundle (file:///Users/d/Projects/resume/node_modules/vitepress/dist/node/serve-JefD-RjH.js:48896:3)
lockieluke commented 8 months ago

I have the same issue when trying to build a multi-page app into static html files

richardtallent commented 8 months ago

Closing this, since this plugin is for single files, not multiple files.

lockieluke commented 8 months ago

i want the multiple files to each be bundling its own js and css

richardtallent commented 8 months ago

If you want multiple entry files, you should fork this plugin or write a new one that does what you need.

It's just not a use case I have, nor do I have time to make it work or support it long-term.

This plugin was written for running an entire SPA from a single file sitting on a local or networked drive, with hash-based routing.

I'm willing to add support for multiple entry files, but it only if adding that support does not significantly complicate or break what this plugin already does, and if those who need that support are willing to contribute code, tests, and documentation and take the lead on any support issues that come up.