Sveltekit build failing on Netlify with "Could not resolve...", whilst succeeding locally

My site is antigamestudiesgamestudiesgame.netlify.app, with the repo currently available here.

When building on Netlify, the build fails to resolve imports using rollup:

When building locally with a fresh clone of the repo, & same node version, it succeeds with no issues.

The full build log:

4:11:52 AM: Build ready to start
4:11:53 AM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
4:11:53 AM: build-image tag: v4.8.0
4:11:53 AM: buildbot version: 29e546ddee264a16af472b38ccba15b350150213
4:11:53 AM: Fetching cached dependencies
4:11:53 AM: Failed to fetch cache, continuing with build
4:11:53 AM: Starting to prepare the repo for build
4:11:54 AM: No cached dependencies found. Cloning fresh repo
4:11:54 AM: git clone https://github.com/Sxxov/aggg
4:11:54 AM: Preparing Git Reference refs/heads/master
4:11:55 AM: Parsing package.json dependencies
4:11:55 AM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '.' in the Netlify UI
4:11:56 AM: Starting build script
4:11:56 AM: Installing dependencies
4:11:56 AM: Python version set to 2.7
4:11:56 AM: Downloading and installing node v16.15.0...
4:11:56 AM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz...
4:11:57 AM: Computing checksum with sha256sum
4:11:57 AM: Checksums matched!
4:11:59 AM: Now using node v16.15.0 (npm v8.5.5)
4:11:59 AM: Started restoring cached build plugins
4:11:59 AM: Finished restoring cached build plugins
4:11:59 AM: Attempting ruby version 2.7.2, read from environment
4:12:00 AM: Using ruby version 2.7.2
4:12:00 AM: Using PHP version 8.0
4:12:01 AM: No npm workspaces detected
4:12:01 AM: Started restoring cached node modules
4:12:01 AM: Finished restoring cached node modules
4:12:01 AM: Installing NPM modules using NPM version 8.5.5
4:12:02 AM: npm WARN EBADENGINE Unsupported engine {
4:12:02 AM: npm WARN EBADENGINE   package: 'amqplib@0.5.2',
4:12:02 AM: npm WARN EBADENGINE   required: { node: '>=0.8 <=9' },
4:12:02 AM: npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
4:12:02 AM: npm WARN EBADENGINE }
4:12:07 AM: npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
4:12:07 AM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
4:12:07 AM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
4:12:07 AM: npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
4:12:09 AM: npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
4:12:10 AM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
4:12:11 AM: npm WARN deprecated extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
4:12:13 AM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
4:12:17 AM: npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
4:12:29 AM: > aggg-client@0.0.0 postinstall
4:12:29 AM: > patch-package
4:12:29 AM: patch-package 6.4.7
4:12:29 AM: Applying patches...
4:12:29 AM: @types/javascript-astar@0.0.31 ✔
4:12:29 AM: javascript-astar@0.4.1 ✔
4:12:29 AM: kursor@0.1.6 ✔
4:12:29 AM: lottie-web@5.9.1 ✔
4:12:29 AM: svelte@3.47.0 ✔
4:12:29 AM: > aggg-client@0.0.0 prepare
4:12:29 AM: > ts-patch install -s
4:12:30 AM: added 1047 packages, and audited 1048 packages in 29s
4:12:30 AM: 118 packages are looking for funding
4:12:30 AM:   run `npm fund` for details
4:12:30 AM: 28 vulnerabilities (10 moderate, 15 high, 3 critical)
4:12:30 AM: To address issues that do not require attention, run:
4:12:30 AM:   npm audit fix
4:12:30 AM: To address all issues possible (including breaking changes), run:
4:12:30 AM:   npm audit fix --force
4:12:30 AM: Some issues need review, and may require choosing
4:12:30 AM: a different dependency.
4:12:30 AM: Run `npm audit` for details.
4:12:30 AM: NPM modules installed
4:12:30 AM: Started restoring cached go cache
4:12:30 AM: Finished restoring cached go cache
4:12:30 AM: go version go1.16.5 linux/amd64
4:12:30 AM: go version go1.16.5 linux/amd64
4:12:30 AM: Installing missing commands
4:12:30 AM: Verify run directory
4:12:32 AM: ​
4:12:32 AM: ────────────────────────────────────────────────────────────────
4:12:32 AM:   Netlify Build                                                 
4:12:32 AM: ────────────────────────────────────────────────────────────────
4:12:32 AM: ​
4:12:32 AM: ❯ Version
4:12:32 AM:   @netlify/build 27.1.1
4:12:32 AM: ​
4:12:32 AM: ❯ Flags
4:12:32 AM:   baseRelDir: true
4:12:32 AM:   buildId: 62782408858f79000974795f
4:12:32 AM:   deployId: 62782408858f790009747961
4:12:32 AM: ​
4:12:32 AM: ❯ Current directory
4:12:32 AM:   /opt/build/repo
4:12:32 AM: ​
4:12:32 AM: ❯ Config file
4:12:32 AM:   /opt/build/repo/netlify.toml
4:12:32 AM: ​
4:12:32 AM: ❯ Context
4:12:32 AM:   production
4:12:32 AM: ​
4:12:32 AM: ────────────────────────────────────────────────────────────────
4:12:32 AM:   1. build.command from netlify.toml                            
4:12:32 AM: ────────────────────────────────────────────────────────────────
4:12:32 AM: ​
4:12:32 AM: $ npm run build
4:12:32 AM: > aggg-client@0.0.0 build
4:12:32 AM: > svelte-kit build
4:12:32 AM: vite v2.9.8 building for production...
4:12:32 AM: transforming...
4:12:35 AM: ✓ 88 modules transformed.
4:12:35 AM: Could not resolve '../core/tailwinder/Tailwinder.js' from src/routes/__layout.svelte
4:12:35 AM: > Could not resolve '../core/tailwinder/Tailwinder.js' from src/routes/__layout.svelte
4:12:35 AM:     at error (/opt/build/repo/node_modules/rollup/dist/shared/rollup.js:198:30)
4:12:35 AM:     at ModuleLoader.handleResolveId (/opt/build/repo/node_modules/rollup/dist/shared/rollup.js:22417:24)
4:12:35 AM:     at /opt/build/repo/node_modules/rollup/dist/shared/rollup.js:22380:26
4:12:35 AM: ​
4:12:35 AM: ────────────────────────────────────────────────────────────────
4:12:35 AM:   "build.command" failed                                        
4:12:35 AM: ────────────────────────────────────────────────────────────────
4:12:35 AM: ​
4:12:35 AM:   Error message
4:12:35 AM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
4:12:35 AM: ​
4:12:35 AM:   Error location
4:12:35 AM:   In build.command from netlify.toml:
4:12:35 AM:   npm run build
4:12:35 AM: ​
4:12:35 AM:   Resolved config
4:12:35 AM:   build:
4:12:35 AM:     base: /opt/build/repo
4:12:35 AM:     command: npm run build
4:12:35 AM:     commandOrigin: config
4:12:35 AM:     publish: /opt/build/repo/build
4:12:35 AM:     publishOrigin: config
4:12:36 AM: Caching artifacts
4:12:36 AM: Started saving node modules
4:12:36 AM: Finished saving node modules
4:12:36 AM: Started saving build plugins
4:12:36 AM: Finished saving build plugins
4:12:36 AM: Started saving pip cache
4:12:36 AM: Finished saving pip cache
4:12:36 AM: Started saving emacs cask dependencies
4:12:36 AM: Finished saving emacs cask dependencies
4:12:36 AM: Started saving maven dependencies
4:12:36 AM: Finished saving maven dependencies
4:12:36 AM: Started saving boot dependencies
4:12:36 AM: Finished saving boot dependencies
4:12:36 AM: Started saving rust rustup cache
4:12:36 AM: Finished saving rust rustup cache
4:12:36 AM: Started saving go dependencies
4:12:36 AM: Finished saving go dependencies
4:12:37 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:12:37 AM: Creating deploy upload records
4:12:37 AM: Failing build: Failed to build site
4:12:37 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:12:38 AM: Finished processing build request in 44.23584375s

Hey @sxxov

The issue you are facing here is one of case sensitivity as although you have referenced '../core/tailwinder/Tailwinder.js' the filename in GitHub is '../core/tailwinder/tailwinder.js'

Thank you! I did manage to find similar advice a while before, but the support forum hid my post for spam so I couldn’t update it oof.

What made it more tricky was that the file was correctly named & cased on my host (Windows), however due to git respecting the case-insensitivity, it didn’t reflect that name change on Github. Cloning it & seeing it work due to Windows being case-insensitive was a double head-scratcher.