I recently noticed my builds were failing. The first error was
[vite-plugin-svelte] Error while preprocessing /opt/build/repo/src/routes/(core)/projects/+page.svelte - Preprocessor dependency "sass" failed to load:
9:29:53 PM: Cannot read properties of undefined (reading "indexOf")
9:29:53 PM: file: /opt/build/repo/src/routes/(core)/projects/+page.svelte
9:29:53 PM: error during build:
9:29:53 PM: TypeError: Cannot read properties of undefined (reading "indexOf")
9:29:53 PM: at /opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:115850:12
9:29:53 PM: at Object.applyHooksTransformer (/opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:1863:14)
9:29:53 PM: at Object.initHooks (/opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:1843:251)
9:29:53 PM: at Object.initNativeDispatchContinue (/opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:1809:9)
9:29:53 PM: at Object.initNativeDispatch (/opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:1803:9)
9:29:53 PM: at Object.getNativeInterceptor (/opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:29105:13)
9:29:53 PM: at Object.getInterceptor$x (/opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:29366:16)
9:29:53 PM: at Object.set$compile$x (/opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:29430:16)
9:29:53 PM: at Object.main (/opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:24215:9)
9:29:53 PM: at main2 (/opt/build/repo/node_modules/.pnpm/sass@1.68.0/node_modules/sass/sass.dart.js:26009:9)
9:29:53 PM: Error: Preprocessor dependency "sass" failed to load:
9:29:53 PM: Cannot read properties of undefined (reading "indexOf")
9:29:53 PM: at loadPreprocessor (file:///opt/build/repo/node_modules/.pnpm/vite@4.4.9_@types+node@20.6.3_sass@1.68.0/node_modules/vite/dist/node/chunks/dep-df561101.js:39272:29)
9:29:53 PM: at scss (file:///opt/build/repo/node_modules/.pnpm/vite@4.4.9_@types+node@20.6.3_sass@1.68.0/node_modules/vite/dist/node/chunks/dep-df561101.js:39310:20)
9:29:53 PM: at compileCSSPreprocessors (file:///opt/build/repo/node_modules/.pnpm/vite@4.4.9_@types+node@20.6.3_sass@1.68.0/node_modules/vite/dist/node/chunks/dep-df561101.js:38735:36)
9:29:53 PM: at compileCSS (file:///opt/build/repo/node_modules/.pnpm/vite@4.4.9_@types+node@20.6.3_sass@1.68.0/node_modules/vite/dist/node/chunks/dep-df561101.js:38785:42)
9:29:53 PM: at async preprocessCSS (file:///opt/build/repo/node_modules/.pnpm/vite@4.4.9_@types+node@20.6.3_sass@1.68.0/node_modules/vite/dist/node/chunks/dep-df561101.js:38969:12)
9:29:53 PM: at async style (file:///opt/build/repo/node_modules/.pnpm/@sveltejs+vite-plugin-svelte@2.4.6_svelte@4.2.1_vite@4.4.9/node_modules/@sveltejs/vite-plugin-svelte/src/preprocess.js:87:31)
9:29:53 PM: at async process_single_tag (file:///opt/build/repo/node_modules/.pnpm/svelte@4.2.1/node_modules/svelte/src/compiler/preprocess/index.js:283:21)
9:29:53 PM: at async Promise.all (index 0)
9:29:53 PM: at async replace_in_code (file:///opt/build/repo/node_modules/.pnpm/svelte@4.2.1/node_modules/svelte/src/compiler/preprocess/replace_in_code.js:69:23)
9:29:53 PM: at async process_tag (file:///opt/build/repo/node_modules/.pnpm/svelte@4.2.1/node_modules/svelte/src/compiler/preprocess/index.js:300:26)
I also noticed a warning…
[WARNING] Cannot find base config file "./.svelte-kit/tsconfig.json" [tsconfig.json]
9:29:51 PM: tsconfig.json:2:12:
9:29:51 PM: 2 │ "extends": "./.svelte-kit/tsconfig.json",
9:29:51 PM: ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I resolved that and from that point onwards I seem to have the same error every time.
The site build locally using vite build
. Dev mode works fine as well, the sass is being processed correctly and rendering correctly on the page that the error logs point to.
The most recent thing I tried to see if it would affect anything was to downgrade sass as it was the lib that was being pointed to in the error but that didn’t chance anything. My reason for posting here is that from what I can tell, I didn’t change anything related to the build between the commits where it build correctly on Netlify and where it broke, and that I can build it successfully locally. These both together certainly make me feel like I didn’t seem to be the cause of the issue (I could be totally wrong and it is something I did but I can’t see the evidence of that yet) and so I am ending up here after a lot of reading through posts and various discussions of similar—but not the same—issues on the various GitHub repos for the libraries involved in the building of this site. Below I’ve added some links to some of the builds. Hopefully this is enough info.
Most recent passing build
Changeset for most recent passing build
First failing build
Changeset for first failing build
Thank you for your time and any help/direction you can give me