linkedin / eyeglass

NPM Modules for Sass
741 stars 60 forks source link

2.2.2 introduced a breaking change (Heimdall dependency) #227

Closed james-nash closed 5 years ago

james-nash commented 5 years ago

Package This issue is related to the following monorepo package(s):

Description Upgrading from 2.2.1 to 2.2.2 (or 2.3.0) breaks my projects' builds. It looks like Eyeglass now depends on heimdalljs, but since it's not declared in Eyeglass's dependencies downstream projects don't have it available.

module.js:550
    throw err;
    ^

Error: Cannot find module 'heimdalljs'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/ja310147/tmp/gravity-test/node_modules/eyeglass/lib/modules/EyeglassModules.js:25:16)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

To Reproduce Steps to reproduce the behavior:

  1. Setup a project that compiles SASS code using Eyeglass (v2.2.2 or higher)
  2. Run the build
  3. See error!

Expected behavior The build should run without errors (as it does for v2.2.1)

Screenshots/Code Examples/Terminal Commands I first noticed this on one of our projects: Gravity. We use Gulp for our builds and that in turn uses Node SASS together with Eyeglass. Our Greenkeeper bot tried upgrading our Eyeglass dependency and spotted the error (see bug).

Since there's a lot going on in our Gulp build, I tried using a simpler setup and can confirm that using Eyeglass 2.2.1 works fine, but 2.2.2 (and up) breaks.

Here's my simple Gulp file that reproduces the issue (it simply tries to compile our Gravity SASS lib, which itself depends on some other SASS libs and therefore requires Eyeglass to compile properly:

// gulpfile.js

const path = require('path');
const gulp = require('gulp');
const sass = require('gulp-sass');
const eyeglass = require('eyeglass');
const gravityPaths = require('@buildit/gravity-ui-sass');

// This project's build output dir
const buildDir = path.resolve(__dirname, 'public');

function compileGravitySass() {
  return gulp.src( gravityPaths.srcSassFilePath )
    .pipe(sass(eyeglass({})))
    .pipe(gulp.dest( buildDir ));
}

module.exports = {
  default: compileGravitySass
};

Environment:

james-nash commented 5 years ago

Awesome. Thanks for fixing that! 👍

I can confirm that the latest versions of Eyeglass are working for us now.