electron-compile icon indicating copy to clipboard operation
electron-compile copied to clipboard

Invalid fileDependencies for SCSS partials

Open alreece45 opened this issue 7 years ago • 0 comments

When using SCSS with partial imports, the proper path of the partials are not stored, resulting in an error.

For example, this works fine on the first load, but not on subsequent loads (from the cache)

@import "base"  /* _base.scss */

When loading from the cache, one will get an error like this (but with full paths):

Failed to compile src/style/index.scss: ENOENT: no such file or directory, lstat 'src/style/base.scss'
Error: ENOENT: no such file or directory, lstat 'src/style/base.scss'
    at fs.lstatSync (fs.js:902:18)
    at Object.fs.lstatSync (ELECTRON_ASAR.js:244:16)
    at Object.realpathSync (fs.js:1542:21)
    at Object.fs.realpathSync (ELECTRON_ASAR.js:321:29)
    at cachedRealpath (node_modules/electron-compile/lib/sanitize-paths.js:25:22)
    at sanitizeFilePath (node_modules/electron-compile/lib/sanitize-paths.js:52:16)
    at FileChangedCache.getCacheEntryForPath (node_modules/electron-compile/lib/file-change-cache.js:201:48)
    at node_modules/electron-compile/lib/file-change-cache.js:239:41
    at Generator.next (<anonymous>)
    at step (node_modules/electron-compile/lib/file-change-cache.js:27:191)

It should have the _base.scss as a dependent file, rather than base.scss

--

I've created a small application that reproduces the issue. It has two buttons, one that changes just the page with two buttons:

  • Reload (Broken): reloads the page, probably from the broken cache)
  • Reload (Working): modifies the scss file, then reloads (compiling the SCSS file, without error).

alreece45 avatar Aug 08 '17 23:08 alreece45