forked from facebook/create-react-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eac8fce
commit 8d679a4
Showing
4 changed files
with
89 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports.default = function(source) { | ||
try { | ||
// XXX performance hit of calling require / require.resolve this for every file passed to this loader? | ||
require.resolve('node-sass'); | ||
|
||
// Options are passed to loader using the function `this`. We use `bind` | ||
// to transparently pass options coming from the webpack config to | ||
// sass-loader: | ||
// XXX performance hit of bind? | ||
const sassLoader = require('sass-loader').bind(this); | ||
|
||
return sassLoader(source); | ||
} catch (er) { | ||
throw new Error( | ||
'It looks like you have required a .scss file. In order for this to work, you need to install node-sass and sass-loader first.' | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters