{"id":11452,"library":"node-sass-tilde-importer","title":"Node Sass Tilde Importer","description":"node-sass-tilde-importer is a custom importer for node-sass that enabled the resolution of Sass `@import` statements beginning with a tilde (~) to absolute paths within the nearest `node_modules` directory. This functionality was essential for integrating npm-installed Sass libraries (e.g., Bootstrap's SCSS files) into projects built with `node-sass` and bundlers like Webpack (via `sass-loader`). The package's current stable version is 1.0.2, last published in March 2018. It has no discernible release cadence, indicating it is no longer actively maintained. Its primary differentiator was providing `~` path resolution for `node-sass`, a feature now largely superseded or natively handled by modern Sass compilers (Dart Sass, available as the `sass` npm package) and contemporary bundler loaders (e.g., `sass-loader` v8+). Given the end-of-life status and deprecation of `node-sass` itself, this package is considered obsolete for new projects and for migrations to modern Sass environments.","status":"abandoned","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/matthewdavidson/node-sass-tilde-importer","tags":["javascript","node-sass","scss","sass","tilde","webpack","sass-loader","node_modules"],"install":[{"cmd":"npm install node-sass-tilde-importer","lang":"bash","label":"npm"},{"cmd":"yarn add node-sass-tilde-importer","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-sass-tilde-importer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This package is a custom importer specifically designed for the `node-sass` compiler.","package":"node-sass","optional":false}],"imports":[{"note":"This package is a CommonJS module and must be imported using `require()`.","wrong":"import tildeImporter from 'node-sass-tilde-importer';","symbol":"tildeImporter","correct":"const tildeImporter = require('node-sass-tilde-importer');"}],"quickstart":{"code":"const sass = require('node-sass');\nconst tildeImporter = require('node-sass-tilde-importer');\n\nconst scssContent = `\n  // Example of importing a node_module like Bootstrap\n  @import \"~bootstrap/scss/functions\";\n  @import \"~bootstrap/scss/variables\";\n  @import \"~bootstrap/scss/mixins\";\n  \n  .my-component {\n    color: $blue;\n    padding: map-get($spacers, 3);\n  }\n`;\n\nsass.render({\n  data: scssContent,\n  importer: tildeImporter,\n  outputStyle: 'expanded'\n}, function(error, result) {\n  if (error) {\n    console.error(`Sass compilation error: ${error.message} on line ${error.line} in ${error.file}`);\n  } else {\n    console.log('Compiled CSS:\\n', result.css.toString());\n  }\n});","lang":"javascript","description":"Demonstrates how to use node-sass-tilde-importer with the deprecated `node-sass` compiler to resolve tilde imports."},"warnings":[{"fix":"Migrate your Sass compilation pipeline from `node-sass` to `sass` (Dart Sass). This package will become obsolete in a Dart Sass environment.","message":"The underlying `node-sass` package, which this importer relies on, is officially deprecated and in end-of-life status. It is no longer actively maintained and has known compatibility issues with newer Node.js versions. You should migrate to Dart Sass (`sass` npm package).","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Remove `node-sass-tilde-importer`. Configure `sass-loader` to use `implementation: require('sass')` and rely on its built-in Webpack resolution for `~` imports, or explicitly set `sassOptions.includePaths` to include `node_modules`.","message":"Dart Sass (the modern `sass` compiler) and modern `sass-loader` versions often handle `~` (tilde) imports to `node_modules` either natively (via `loadPaths` or direct resolution) or through Webpack's resolver, rendering this custom importer unnecessary. Using this package with Dart Sass is typically not required and may cause issues.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid using this package in new projects. For existing projects, prioritize migrating to Dart Sass and removing this dependency.","message":"This `node-sass-tilde-importer` package itself is unmaintained, with its last publish being 8 years ago (March 2018). It is unlikely to receive updates for new Sass features or compatibility fixes with newer Node.js environments.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"As part of migrating to Dart Sass, update your Sass stylesheets to use the `@use` and `@forward` syntax instead of `@import`.","message":"The `@import` rule, which this importer modifies, is deprecated in Dart Sass 1.80.0 and will be removed in Dart Sass 3.0.0. The modern Sass module system encourages the use of `@use` and `@forward` rules instead.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Uninstall `node-sass` and replace it with `sass` (Dart Sass). If using a build tool like Webpack, ensure `sass-loader` is configured to use `sass` as its `implementation`.","cause":"Your project is still using `node-sass` or a dependency that pulls in `node-sass`, which is now deprecated.","error":"Error: 'node-sass' usage is deprecated and will be removed in a future major version."},{"fix":"If using `sass-loader` with Dart Sass, remove `node-sass-tilde-importer`. `sass-loader` should handle `~` prefixes to `node_modules` automatically. If issues persist, configure `sassOptions.includePaths` in your `sass-loader` options to explicitly include `node_modules`.","cause":"This error can occur if you've migrated to Dart Sass or a newer `sass-loader` version, but `node-sass-tilde-importer` is either still present and causing conflicts, or has been removed without correctly configuring the new Sass environment for `~` path resolution.","error":"SassError: Can't find stylesheet to import: ~your-package/path"}],"ecosystem":"npm"}