onehilltech / ember-cli-mdc

ember-cli addon for material-components-web
Apache License 2.0
44 stars 15 forks source link

Sass compiler crashes on large apps #13

Closed ivanvanderbyl closed 3 years ago

ivanvanderbyl commented 5 years ago

We have about 100k modules in node_modules, the default setup of mdc-sass is to add all of node_modules to the import path of sass, which in turn watches all files and basically chews up all resources.

After about 10 minutes of compiling we start to run out of available file descriptors and memory.

A better approach would be to use normal ember-cli-sass, and configure it as follows:

  sassOptions: {
      includePaths: ['node_modules/@material', 'addon/styles'],
      onlyIncluded: true,

      importer: function(url, prev, done) {
        if (url.startsWith('@material')) {
          let file = url.replace(/@material\//, '')
          done({ file })
        } else {
          done({ file: url })
        }
      },
    }
hilljh82 commented 5 years ago

@ivanvanderbyl Thanks for this suggestion. We originally used ember-cli-sass, but ran into the issue you are explaining in our projects. That why we created a new version. I will give your suggestion a try simce i did not know about the importer property. I rather adapt ember-cli-sass than maintain our own.

hilljh82 commented 5 years ago

@ivanvanderbyl FYI, we will be working on this fix after we completely update the targets for ember-cli-mdc to material-components-web v2.0.0.

ivanvanderbyl commented 5 years ago

Thanks for the update. I have a fork which implements this, I'll clean it and open a PR here,.

hilljh82 commented 3 years ago

@ivanvanderbyl I know its been a while, but where in the add-on are you configuring the sassOptions above?

hilljh82 commented 3 years ago

@ivanvanderbyl I figured it out.