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

OS dependent dependencies break build due to mutual exlusivity #328

Open
secana opened this issue Jun 1, 2024 · 0 comments
Open

OS dependent dependencies break build due to mutual exlusivity #328

secana opened this issue Jun 1, 2024 · 0 comments

Comments

@secana
Copy link

secana commented Jun 1, 2024

Hi!

I try to build a project with esbuild and rollup. Take the following package.json as an example.

{
  "name": "kellnr",
  "version": "0.1.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "type-check": "vue-tsc --noEmit --composite false",
    "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
  },
  "dependencies": {
    "@fortawesome/fontawesome-free": "^6.4.2",
    "axios": "^1.6.1",
    "axios-cache-interceptor": "^1.3.2",
    "bulma": "^1.0.0",
    "bulma-switch": "^2.0.4",
    "core-js": "^3.33.3",
    "dayjs": "^1.11.10",
    "dompurify": "^3.0.6",
    "js-cookie": "^3.0.5",
    "marked": "^12.0.0",
    "marked-gfm-heading-id": "^3.1.1",
    "marked-highlight": "^2.0.7",
    "marked-mangle": "^1.1.5",
    "vue": "^3.3.9",
    "vue-axios": "^3.5.2",
    "vue-class-component": "^8.0.0-0",
    "vue-router": "^4.2.5",
    "vue3-highlightjs": "^1.0.5",
    "vuex": "^4.1.0",
    "vuex-persistedstate": "^4.1.0"
  },
  "devDependencies": {
    "@types/dompurify": "^3.0.4",
    "@types/node": "^20.12.7",
    "@types/marked": "^6.0.0",
    "@vitejs/plugin-vue": "5.0.4",
    "@vue/eslint-config-typescript": "^13.0.0",
    "@vue/tsconfig": "^0.5.1",
    "babel-eslint": "^10.1.0",
    "eslint": "^8.56.0",
    "eslint-plugin-vue": "^9.18.1",
    "typescript": "~5.4.2",
    "vite": "5.2.11",
    "vue-tsc": "^2.0.4",
    "esbuild": "^0.20.2"
  },
  "overrides": {
    "vite": {
      "rollup": "npm:@rollup/wasm-node"
    }
  }
}

node2nix runs fine but when I execute npm run build later to build the application, it complains that @esbuild/linux-arm64 and @rollup/rollup-linux-arm64-gnu are missing. If I add them to the package.json and run everything again, it works fine.

Now to the issue: It just works for Linux ARM64, if the same flake tries to build on e.g. Darwin, it fails because the Linux ARM64 packages cannot be installed. The package.json below shows the issue. I need the native deps for each platform but they are mutually exclusive.

{
  "name": "kellnr",
  "version": "0.1.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "type-check": "vue-tsc --noEmit --composite false",
    "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
  },
  "dependencies": {
    "@fortawesome/fontawesome-free": "^6.4.2",
    "axios": "^1.6.1",
    "axios-cache-interceptor": "^1.3.2",
    "bulma": "^1.0.0",
    "bulma-switch": "^2.0.4",
    "core-js": "^3.33.3",
    "dayjs": "^1.11.10",
    "dompurify": "^3.0.6",
    "js-cookie": "^3.0.5",
    "marked": "^12.0.0",
    "marked-gfm-heading-id": "^3.1.1",
    "marked-highlight": "^2.0.7",
    "marked-mangle": "^1.1.5",
    "vue": "^3.3.9",
    "vue-axios": "^3.5.2",
    "vue-class-component": "^8.0.0-0",
    "vue-router": "^4.2.5",
    "vue3-highlightjs": "^1.0.5",
    "vuex": "^4.1.0",
    "vuex-persistedstate": "^4.1.0"
  },
  "devDependencies": {
    "@types/dompurify": "^3.0.4",
    "@types/node": "^20.12.7",
    "@types/marked": "^6.0.0",
    "@vitejs/plugin-vue": "5.0.4",
    "@vue/eslint-config-typescript": "^13.0.0",
    "@vue/tsconfig": "^0.5.1",
    "babel-eslint": "^10.1.0",
    "eslint": "^8.56.0",
    "eslint-plugin-vue": "^9.18.1",
    "typescript": "~5.4.2",
    "vite": "5.2.11",
    "vue-tsc": "^2.0.4",
    "esbuild": "^0.20.2",
    "@esbuild/linux-arm64": "^0.20.2",
    "@esbuild/darwin-arm64": "^0.20.2",
    "@rollup/rollup-linux-arm64-gnu": "^4.18.0",
    "@rollup/rollup-darwin-arm64": "^4.18.0"
  },
  "overrides": {
    "vite": {
      "rollup": "npm:@rollup/wasm-node"
    }
  }
}

Any idea how to solve this issue?

Full flake.nix: https://github.com/kellnr/kellnr/blob/static-build/flake.nix

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

No branches or pull requests

1 participant