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

SSR multi-page app build error: Multiple inputs are not supported for "output.inlineDynamicImports". #2656

Closed
6 tasks done
ondrejrohon opened this issue Mar 23, 2021 · 6 comments

Comments

@ondrejrohon
Copy link

ondrejrohon commented Mar 23, 2021

Describe the bug

Building server for multi-page app with SSR throws this error:

Multiple inputs are not supported for "output.inlineDynamicImports".
error during build:
Error: Multiple inputs are not supported for "output.inlineDynamicImports".
    at error (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/rollup/dist/shared/rollup.js:5308:30)
    at getInlineDynamicImports (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/rollup/dist/shared/rollup.js:19962:16)
    at normalizeOutputOptions (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/rollup/dist/shared/rollup.js:19866:34)
    at getOutputOptions (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/rollup/dist/shared/rollup.js:20238:12)
    at getOutputOptionsAndPluginDriver (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/rollup/dist/shared/rollup.js:20233:12)
    at handleGenerateWrite (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/rollup/dist/shared/rollup.js:20210:74)
    at Object.write (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/rollup/dist/shared/rollup.js:20178:20)
    at generate (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/vite/dist/node/chunks/dep-efe32886.js:44150:64)
    at doBuild (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/vite/dist/node/chunks/dep-efe32886.js:44207:26)
    at async build (/Users/ondrejrohon/Documents/Deepnote/repos/vite-multipage/node_modules/vite/dist/node/chunks/dep-efe32886.js:44079:16)
error Command failed with exit code 1.

Reproduction

https://github.com/ondrejrohon/vite-multipage-test

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

System:
OS: macOS 10.15.7
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 64.46 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.14.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.8 - /usr/local/bin/npm
Browsers:
Brave Browser: 89.1.21.77
Chrome: 89.0.4389.90
Firefox: 85.0.2
Safari: 14.0.3
npmPackages:
vite: ^2.1.2 => 2.1.2

v14.14.0

Used package manager: yarn

Logs


Before submitting the issue, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
@ondrejrohon
Copy link
Author

ondrejrohon commented Mar 23, 2021

I tried to add inlineDynamicImports: false, https://github.com/ondrejrohon/vite-multipage-test/blob/70068f92903fceb91a5fffd7d7c9dfe8723b66f7/vite.config.ts#L14 here and it fixes that error. But still building server doesn't.

If I comment out build object from config it correctly compiles server code:

yarn run v1.22.10
warning package.json: No license field
$ vite build --ssr src/entry-server.tsx --outDir dist/server
vite v2.1.2 building SSR bundle for production...
✓ 5 modules transformed.
dist/server/entry-server.js   3.57kb
✨  Done in 0.50s.

However with following config:

export default defineConfig({
  plugins: [reactRefresh()],
  build: {
    rollupOptions: {
      input: {
        main: path.resolve(__dirname, 'index.html'),
        nested: path.resolve(__dirname, 'page2.html'),
      },
      output: {
        inlineDynamicImports: false,
      }
    }
  }
})

running yarn build:server doesn't compile entry-server and compiles front-end code instead:

yarn run v1.22.10
warning package.json: No license field
$ vite build --ssr src/entry-server.tsx --outDir dist/server
vite v2.1.2 building SSR bundle for production...
✓ 10 modules transformed.
dist/server/index.html               0.43kb
dist/server/page2.html               0.44kb
dist/server/main.js                  1.66kb
dist/server/nested.js                1.66kb
dist/server/assets/App.b1fb2009.js   1.11kb

@yaquawa
Copy link
Contributor

yaquawa commented Apr 12, 2021

@ondrejrohon I'm running into the same problem. Thanks for the test repo.

Does anyone know how to fix this ?

@ondrejrohon
Copy link
Author

@ondrejrohon I'm running into the same problem. Thanks for the test repo.

Does anyone know how to fix this ?

I still haven't found any solution to this, and it unfortunately stopped me to migrate my project to Vite :(

@yaquawa
Copy link
Contributor

yaquawa commented Apr 12, 2021

@ondrejrohon yeah.. I've released a plugin for Vite to do SSR, still stuck at the Muti-Page building and #2958 , looks like this feature is still not yet on ready for production.

@mijamo
Copy link

mijamo commented Apr 12, 2021

I encountered the same problem. So far my workaround is to have 2 vite config files: one for building the app JS and one for the SSR. The app Vite config basically inherits from the SSR and adds the different entrypoints in rollupOptions.

@sapphi-red
Copy link
Member

Closing as #7275 fixed #2656 (comment).

@github-actions github-actions bot locked and limited conversation to collaborators Jul 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants