Vite dependency on rollup vs. full-source builds #1364

Open
opened 2025-03-05 04:20:38 +00:00 by lanodan · 3 comments
Owner

Vite directly depends on two node modules requiring native executables:

  • esbuild which is pretty easy to package, it only depends on Go and the /x/sys/ Go extended standard library
  • rollup which is a completely different story, last time I tried to build it from source (September 2023) I ended up with noticing at least 3 circular dependencies (rollup → rollup; rollup → acorn → rollup; rollup → eslint → webpack → acorn → eslint). Looking at it now, you get Rust in the mix hence why it's straight up linux executables instead of minified JS blobs…

This manifests like this when automatically removing known executable binary formats in the build:

>>> Source unpacked in /var/tmp/portage/www-apps/pleroma-fe-9999/work
>>> Preparing source in /var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999 ...
>>> Source prepared.
:: Checking for blobs
removing Wasm:  pleroma-fe-9999/node_modules/@one-ini/wasm/one_ini_bg.wasm
removing ELF:   pleroma-fe-9999/node_modules/vite-node/node_modules/@esbuild/linux-x64/bin/esbuild
removing ELF:   pleroma-fe-9999/node_modules/@esbuild/linux-x64/bin/esbuild
removing ELF:   pleroma-fe-9999/node_modules/chromedriver/lib/chromedriver/chromedriver
removing ELF:   pleroma-fe-9999/node_modules/selenium-webdriver/bin/linux/selenium-manager
removing Mach-O exec:   pleroma-fe-9999/node_modules/selenium-webdriver/bin/macos/selenium-manager
removing WinNT EXE:     pleroma-fe-9999/node_modules/selenium-webdriver/bin/windows/selenium-manager.exe
removing Wasm:  pleroma-fe-9999/node_modules/@ruffle-rs/ruffle/d375f63dccdd6adfeb5d.wasm
removing Wasm:  pleroma-fe-9999/node_modules/@ruffle-rs/ruffle/aa624a8a2e84e887e04b.wasm
removing ELF:   pleroma-fe-9999/node_modules/vitest/node_modules/@esbuild/linux-x64/bin/esbuild
removing ELF:   pleroma-fe-9999/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node
removing ELF:   pleroma-fe-9999/node_modules/@parcel/watcher-linux-x64-musl/watcher.node
removing WinNT EXE:     pleroma-fe-9999/node_modules/playwright-core/bin/PrintDeps.exe
removing ELF:   pleroma-fe-9999/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node
removing ELF:   pleroma-fe-9999/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node
:: Done checking for blobs
 * blobs have been found by deblob, see build.log
>>> Configuring source in /var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999 ...
yarn run v1.22.22
$ node build/update-emoji.js && vite build
Updating emojis...
Done.
/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:64
                throw new Error(
                      ^

Error: Cannot find module @rollup/rollup-linux-x64-musl. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at requireWithFriendlyError (/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:64:9)
    at Object.<anonymous> (/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:73:76)
    at Module._compile (node:internal/modules/cjs/loader:1562:14)
    at Object..js (node:internal/modules/cjs/loader:1699:10)
    at Module.load (node:internal/modules/cjs/loader:1313:32)
    at Function._load (node:internal/modules/cjs/loader:1123:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at cjsLoader (node:internal/modules/esm/translators:263:5)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:196:7) {
  [cause]: Error: Cannot find module '/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node'. Please verify that the package.json has a valid "main" entry
      at tryPackage (node:internal/modules/cjs/loader:492:19)
      at Function._findPath (node:internal/modules/cjs/loader:790:18)
      at Function._resolveFilename (node:internal/modules/cjs/loader:1230:27)
      at Function._load (node:internal/modules/cjs/loader:1070:27)
      at TracingChannel.traceSync (node:diagnostics_channel:322:14)
      at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
      at Module.require (node:internal/modules/cjs/loader:1335:12)
      at require (node:internal/modules/helpers:136:16)
      at requireWithFriendlyError (/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:46:10)
      at Object.<anonymous> (/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:73:76) {
    code: 'MODULE_NOT_FOUND',
    path: '/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/@rollup/rollup-linux-x64-musl/package.json',
    requestPath: '@rollup/rollup-linux-x64-musl'
  }
}

Node.js v22.13.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Vite directly depends on two node modules requiring native executables: - `esbuild` which is pretty easy to package, it only depends on Go and the `/x/sys/` Go extended standard library - `rollup` which is a completely different story, last time I tried to build it from source (September 2023) I ended up with noticing at least 3 circular dependencies (rollup → rollup; rollup → acorn → rollup; rollup → eslint → webpack → acorn → eslint). Looking at it now, you get Rust in the mix hence why it's straight up linux executables instead of minified JS blobs… This manifests like this when automatically removing known executable binary formats in the build: ``` >>> Source unpacked in /var/tmp/portage/www-apps/pleroma-fe-9999/work >>> Preparing source in /var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999 ... >>> Source prepared. :: Checking for blobs removing Wasm: pleroma-fe-9999/node_modules/@one-ini/wasm/one_ini_bg.wasm removing ELF: pleroma-fe-9999/node_modules/vite-node/node_modules/@esbuild/linux-x64/bin/esbuild removing ELF: pleroma-fe-9999/node_modules/@esbuild/linux-x64/bin/esbuild removing ELF: pleroma-fe-9999/node_modules/chromedriver/lib/chromedriver/chromedriver removing ELF: pleroma-fe-9999/node_modules/selenium-webdriver/bin/linux/selenium-manager removing Mach-O exec: pleroma-fe-9999/node_modules/selenium-webdriver/bin/macos/selenium-manager removing WinNT EXE: pleroma-fe-9999/node_modules/selenium-webdriver/bin/windows/selenium-manager.exe removing Wasm: pleroma-fe-9999/node_modules/@ruffle-rs/ruffle/d375f63dccdd6adfeb5d.wasm removing Wasm: pleroma-fe-9999/node_modules/@ruffle-rs/ruffle/aa624a8a2e84e887e04b.wasm removing ELF: pleroma-fe-9999/node_modules/vitest/node_modules/@esbuild/linux-x64/bin/esbuild removing ELF: pleroma-fe-9999/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node removing ELF: pleroma-fe-9999/node_modules/@parcel/watcher-linux-x64-musl/watcher.node removing WinNT EXE: pleroma-fe-9999/node_modules/playwright-core/bin/PrintDeps.exe removing ELF: pleroma-fe-9999/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node removing ELF: pleroma-fe-9999/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node :: Done checking for blobs * blobs have been found by deblob, see build.log >>> Configuring source in /var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999 ... >>> Source configured. >>> Compiling source in /var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999 ... yarn run v1.22.22 $ node build/update-emoji.js && vite build Updating emojis... Done. /var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:64 throw new Error( ^ Error: Cannot find module @rollup/rollup-linux-x64-musl. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory. at requireWithFriendlyError (/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:64:9) at Object.<anonymous> (/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:73:76) at Module._compile (node:internal/modules/cjs/loader:1562:14) at Object..js (node:internal/modules/cjs/loader:1699:10) at Module.load (node:internal/modules/cjs/loader:1313:32) at Function._load (node:internal/modules/cjs/loader:1123:12) at TracingChannel.traceSync (node:diagnostics_channel:322:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at cjsLoader (node:internal/modules/esm/translators:263:5) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:196:7) { [cause]: Error: Cannot find module '/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node'. Please verify that the package.json has a valid "main" entry at tryPackage (node:internal/modules/cjs/loader:492:19) at Function._findPath (node:internal/modules/cjs/loader:790:18) at Function._resolveFilename (node:internal/modules/cjs/loader:1230:27) at Function._load (node:internal/modules/cjs/loader:1070:27) at TracingChannel.traceSync (node:diagnostics_channel:322:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Module.require (node:internal/modules/cjs/loader:1335:12) at require (node:internal/modules/helpers:136:16) at requireWithFriendlyError (/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:46:10) at Object.<anonymous> (/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/rollup/dist/native.js:73:76) { code: 'MODULE_NOT_FOUND', path: '/var/tmp/portage/www-apps/pleroma-fe-9999/work/pleroma-fe-9999/node_modules/@rollup/rollup-linux-x64-musl/package.json', requestPath: '@rollup/rollup-linux-x64-musl' } } Node.js v22.13.1 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ```

I don't understand what this is about. gentoo?

I don't understand what this is about. gentoo?
Member

Looks like Gentoo with a custom deblob build step

Looks like Gentoo with a custom `deblob` build step
Author
Owner

Yeah, I have that rigged up for all packages. As a way of making sure that you're actually building from source and not just pushing blobs around.

Yeah, I have that rigged up for all packages. As a way of making sure that you're actually building from source and not just pushing blobs around.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma-fe#1364
No description provided.