electron-userland / electron-compile

DEPRECATED: Electron supporting package to compile JS and CSS in Electron applications
1.01k stars 99 forks source link

Invalid fileDependencies for SCSS partials #255

Open alreece45 opened 7 years ago

alreece45 commented 7 years ago

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: