diff --git a/src/utils.js b/src/utils.js index 06e3080..dc54373 100644 --- a/src/utils.js +++ b/src/utils.js @@ -348,7 +348,9 @@ async function createEvaluator(loaderContext, code, options) { let webpackResolveError; if (node.name !== 'url' && nodePath && !URL_RE.test(nodePath)) { - const dependencies = resolvedDependencies.get(node.filename); + const dependencies = resolvedDependencies.get( + path.normalize(node.filename) + ); if (dependencies) { const dependency = dependencies.find((item) => { diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index eb5be58..8f6a63b 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -139,6 +139,73 @@ exports[`loader imports files listed in glob with deps: errors 1`] = `Array []`; exports[`loader imports files listed in glob with deps: warnings 1`] = `Array []`; +exports[`loader imports files listed in glob with webpack import 2: css 1`] = ` +".a-glob { + color: #000; +} +.b-glob { + background: #808080; +} +.a-glob-webpack { + color: #000; +} +.b-glob-webpack { + background: #808080; +} +.a-glob { + color: #000; +} +.b-glob { + background: #808080; +} +.a-glob-webpack { + color: #000; +} +.b-glob-webpack { + background: #808080; +} +.glob-entry { + box-sizing: border-box; +} +" +`; + +exports[`loader imports files listed in glob with webpack import 2: errors 1`] = `Array []`; + +exports[`loader imports files listed in glob with webpack import 2: warnings 1`] = `Array []`; + +exports[`loader imports files listed in glob with webpack import with deps: css 1`] = ` +".a-glob { + color: #000; +} +.b-glob { + background: #808080; +} +.a-glob-webpack { + color: #000; +} +.b-glob-webpack { + background: #808080; +} +.glob-in-node { + color: #fff; +} +.glob-in-node { + background: #ff7f50; +} +.index-glob { + font-size: 1rem; +} +.glob-entry { + box-sizing: border-box; +} +" +`; + +exports[`loader imports files listed in glob with webpack import with deps: errors 1`] = `Array []`; + +exports[`loader imports files listed in glob with webpack import with deps: warnings 1`] = `Array []`; + exports[`loader imports files listed in nested glob import: css 1`] = ` ".a-nested-glob { color: #f00; @@ -329,6 +396,17 @@ exports[`loader in a nested import load module from paths: errors 1`] = `Array [ exports[`loader in a nested import load module from paths: warnings 1`] = `Array []`; +exports[`loader in a nested import load module from webpack: css 1`] = ` +".imported-in-web-modules { + font-size: 2em; +} +" +`; + +exports[`loader in a nested import load module from webpack: errors 1`] = `Array []`; + +exports[`loader in a nested import load module from webpack: warnings 1`] = `Array []`; + exports[`loader resolve with webpack if stylus can't find it: css 1`] = ` ".imported-in-web-modules { font-size: 2em; diff --git a/test/loader.test.js b/test/loader.test.js index a8a5646..40931b7 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -410,7 +410,7 @@ describe('loader', () => { expect(getErrors(stats)).toMatchSnapshot('errors'); }); - it.skip('in a nested import load module from webpack', async () => { + it('in a nested import load module from webpack', async () => { const testId = './shallow-webpack.styl'; const compiler = getCompiler( testId, @@ -858,7 +858,7 @@ describe('loader', () => { expect(getErrors(stats)).toMatchSnapshot('errors'); }); - it.skip('imports files listed in glob with webpack import with deps', async () => { + it('imports files listed in glob with webpack import with deps', async () => { const testId = './import-glob-webpack.styl'; const compiler = getCompiler( testId, @@ -940,7 +940,7 @@ describe('loader', () => { expect(getErrors(stats)).toMatchSnapshot('errors'); }); - it.skip('imports files listed in glob with webpack import 2', async () => { + it('imports files listed in glob with webpack import 2', async () => { const testId = './import-glob-webpack-2.styl'; const compiler = getCompiler( testId,