Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parcel Bundler: import scss files from node_modules without specifying the full path?

Tags:

parceljs

Currently, I import scss files like this:

@import './node_modules/bulma/bulma';

However, in Laravel Mix I learned that I could just import the files like this, without specifying ./node_modules:

@import '~bulma/bulma';

Anyway I could do this in ParcelJS?

like image 493
Joshua Leung Avatar asked Dec 28 '17 03:12

Joshua Leung


1 Answers

The sass-loader in webpack uses node-sass' custom importer feature to pass all queries to the webpack resolving engine.

But In parcel-bundler,

The node_modules resolution algorithm isn't implemented yet for SASS/SCSS. Currently you could make a .sassrc or .sassrc.js file to configure the node-sass includePaths option to include node_modules.

current workaround is found in this discussion

like image 146
Charles Dominic Avatar answered Oct 24 '22 04:10

Charles Dominic