Skip to content

Commit 090801a

Browse files
authored
Merge pull request #12 from epegzz/feat/hot-reload
Feat/hot reload
2 parents 05d9970 + 31c3d96 commit 090801a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

convert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function formatValue(value) {
3434
prefix: '',
3535
suffix: ',',
3636
suffixLastItem: false,
37-
}
37+
};
3838
return '(\n' + objToValue(value, opts) + '\n)';
3939
}
4040

index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const loaderUtils = require('loader-utils');
44
const fs = require('fs');
55
const convert = require('./convert');
6+
const path = require('path');
67

78
const loader = function(content)
89
{
@@ -16,12 +17,12 @@ const loader = function(content)
1617
config.files = [config.files];
1718
}
1819
config.files.forEach((path) => {
19-
path = path.replace(/["']/g, '');
20-
this.addDependency(path);
2120
if (path.endsWith('.json')) {
2221
Object.assign(vars, JSON.parse(fs.readFileSync(path, 'utf8')));
2322
}
2423
if (path.endsWith('.js')) {
24+
const resolvedFilePath = path.resolve(path.replace(/["']/g, ''));
25+
delete require.cache[resolvedFilePath];
2526
Object.assign(vars, require(path));
2627
}
2728
})

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@epegzz/sass-vars-loader",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"author": "Daniel Schäfer <[email protected]>",
55
"description": "A SASS vars loader for Webpack. Load global SASS vars from JS/JSON files or from Webpack config.",
66
"files": [

0 commit comments

Comments
 (0)