From 32e5366e89a6d908786d307756230f319d44c632 Mon Sep 17 00:00:00 2001 From: yinheli Date: Wed, 22 Feb 2017 15:28:44 +0800 Subject: [PATCH 1/2] adapt for webpack2 loader suffix is no longer optional in webpack2 for clarity reasons @see https://webpack.js.org/configuration/#options --- lib/loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/loader.js b/lib/loader.js index 1448b59d2..1feffb83c 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -145,7 +145,7 @@ module.exports = function (content) { return defaultLoaders.html + '!' + rewriter + templateLoader + '?raw&engine=' + lang + '!' case 'style': loader = addCssModulesToLoader(defaultLoaders.css, part, index) - return loader + '!' + rewriter + lang + '!' + return loader + '!' + rewriter + lang + '-loader' + '!' case 'script': return injectString + lang + '!' } From 4da55efbb01b39f3b790b3953c6e8b29ff913208 Mon Sep 17 00:00:00 2001 From: yinheli Date: Wed, 22 Feb 2017 15:30:21 +0800 Subject: [PATCH 2/2] fix tests, className failed in windows test className is not always start with "_" --- test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index 4424567eb..cffa42686 100644 --- a/test/test.js +++ b/test/test.js @@ -306,7 +306,7 @@ describe('vue-loader', function () { // get local class name var className = module.computed.style().red - expect(className).to.match(/^_/) + expect(className).to.match(/_/) // class name in style var style = [].slice.call(window.document.querySelectorAll('style')).map(function (style) { @@ -323,7 +323,7 @@ describe('vue-loader', function () { // default module + pre-processor + scoped var anotherClassName = module.computed.$style().red - expect(anotherClassName).to.match(/^_/).and.not.equal(className) + expect(anotherClassName).to.match(/_/).and.not.equal(className) var id = '_v-' + hash(require.resolve('./fixtures/css-modules.vue')) expect(style).to.contain('.' + anotherClassName + '[' + id + ']')