giladgray / blueprint-sass-compile

a handy little package to compile blueprint.scss from source
1 stars 0 forks source link

path.dirname is not a function #2

Open maclockard opened 4 years ago

maclockard commented 4 years ago

On node v12.18.3, I get the following error when running the script:

$ ./build_blueprint.sh ./blueprint_overrides.scss
$ /Users/maclockard/workspace/hex-inc/hex/packages/client/node_modules/.bin/node-sass-chokidar --functions node_modules/blueprint-sass-compile/sass-inline-svg.js --importer node_modules/node-sass-package-importer/dist/cli.js --output lib --source-map true ./blueprint_overrides.scss
GET https://raw.githubusercontent.com/palantir/blueprint/develop/resources/icons/16px/chevron-right.svg
{
  "status": 1,
  "file": "/Users/maclockard/workspace/hex-inc/hex/node_modules/@blueprintjs/core/src/components/breadcrumbs/_breadcrumbs.scss",
  "line": 41,
  "column": 19,
  "message": "error in C function svg-icon: path.dirname is not a function",
  "formatted": "Error: error in C function svg-icon: path.dirname is not a function
          on line 41 of ../../node_modules/@blueprintjs/core/src/components/breadcrumbs/_breadcrumbs.scss, in function `svg-icon`
          from line 41 of ../../node_modules/@blueprintjs/core/src/components/breadcrumbs/_breadcrumbs.scss
          from line 5 of ../../node_modules/@blueprintjs/core/src/components/_index.scss
          from line 16 of ../../node_modules/@blueprintjs/core/src/blueprint.scss
          from line 5 of blueprint_overrides.scss
          >>       background: svg-icon(\"16px/chevron-right.svg\", (path: (fill: $pt-icon-
     ------------------^
     "
}

A bit confused by this since running node cli, I can use dirname as a function. My guess is that this is due to sass using its own node runtime or something?

maclockard commented 4 years ago

tried switching over to dart-sass to see if that would fix it since node-sass has been deprecated. However, blueprint can't compile using newer versions of sass so it didn't work

fionawhim commented 3 years ago

The problem here is that the path argument in the svg-icon function is shadowing the path required at the top of the file. If you rename either the argument or the import it solves this problem.