Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dc69eec

Browse files
author
Alexey Litvinov
committed
fix usage of resolve-imports plugin
1 parent baf3178 commit dc69eec

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

‎package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"postcss": "^6.0.1",
6060
"postcss-modules-extract-imports": "^1.0.0",
6161
"postcss-modules-local-by-default": "^1.0.1",
62-
"postcss-modules-parser": "^1.1.0",
6362
"postcss-modules-resolve-imports": "^1.3.0",
6463
"postcss-modules-scope": "^1.0.0",
6564
"postcss-modules-values": "^1.1.1",

‎src/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Values = require('postcss-modules-values');
1515
const LocalByDefault = require('postcss-modules-local-by-default');
1616
const ExtractImports = require('postcss-modules-extract-imports');
1717
const Scope = require('postcss-modules-scope');
18-
const Parser = require('postcss-modules-parser');
18+
const ResolveImports = require('postcss-modules-resolve-imports');
1919

2020
const debugFetch = require('debug')('css-modules:fetch');
2121
const debugSetup = require('debug')('css-modules:setup');
@@ -40,6 +40,7 @@ module.exports = function setupHook({
4040
debugSetup(arguments[0]);
4141
validate(arguments[0]);
4242

43+
const exts = toArray(extensions);
4344
const tokensByFile = {};
4445

4546
// debug option is preferred NODE_ENV === 'development'
@@ -56,7 +57,7 @@ module.exports = function setupHook({
5657
// small fallback
5758
scopedName = (local, filename) => Scope.generateScopedName(local, relative(context, filename));
5859

59-
const plugins = (use || [
60+
const plugins = use || [
6061
...prepend,
6162
Values,
6263
mode
@@ -66,8 +67,9 @@ module.exports = function setupHook({
6667
? new ExtractImports({createImportedName})
6768
: ExtractImports,
6869
new Scope({generateScopedName: scopedName}),
70+
new ResolveImports({resolve: {extensions: exts}}),
6971
...append,
70-
]).concat(newParser({fetch}));// no pushing in order to avoid the possible mutations;
72+
];
7173

7274
// https://github.com/postcss/postcss#options
7375
const runner = postcss(plugins);
@@ -99,7 +101,7 @@ module.exports = function setupHook({
99101
// https://github.com/postcss/postcss/blob/master/docs/api.md#lazywarnings
100102
lazyResult.warnings().forEach(message => console.warn(message.text));
101103

102-
tokens = lazyResult.root.tokens;
104+
tokens = lazyResult.root.exports||{};
103105

104106
if (!debugMode)
105107
// updating cache
@@ -117,7 +119,6 @@ module.exports = function setupHook({
117119
return tokens;
118120
}
119121

120-
const exts = toArray(extensions);
121122
const isException = buildExceptionChecker(ignore);
122123

123124
const hook = filename => {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /