Open bertho-zero opened 4 years ago
My workaround:
const importOnce = require('node-sass-import-once'); let pnp; try { pnp = require('pnpapi'); } catch (error) { // pnpapi is not defined pnp = null; } function importer(uri, prev, done) { let resolution; let pnpError; try { resolution = pnp.resolveToUnqualified(uri, prev, { considerBuiltins: false }); } catch (error) { pnpError = error; } importOnce.call(this, resolution || uri, prev, result => { const keys = Object.keys(result); if (keys.length) { return done(result); } if (pnpError) { console.error(pnpError); } return importOnce.call(this, uri, prev, done); }); } /***/ sass.render({ file: filename, importer: pnp ? importer : importOnce, includePaths: pnp ? [] : [ path.resolve(__dirname, '..'), path.resolve(__dirname, '../node_modules'), path.resolve(__dirname, '../../../node_modules') ] })
My workaround: