Skip to content

Commit 63f98d2

Browse files
Add test matrix for webpack@2.
1 parent 4dd67f9 commit 63f98d2

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

.travis.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
sudo: false
22
language: node_js
3+
node_js:
4+
- 4
5+
- 5
6+
- 6
7+
env:
8+
- USE_WEBPACK2=false
9+
- USE_WEBPACK2=true
310
matrix:
4-
include:
5-
- node_js: 4
6-
- node_js: 5
7-
- node_js: 6
11+
exclude:
12+
# TODO: Fix barf on peer dependencies with npm@2.
13+
- env: USE_WEBPACK2=true
14+
node_js: 4
815

16+
before_install:
17+
- 'if [ "${USE_WEBPACK2}" == "true" ]; then npm install --save-dev webpack@2.1.0-beta.19 extract-text-webpack-plugin@2.0.0-beta.4; fi'
918

1019
after_script:
1120
- npm install coveralls

example/basic/webpack.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ module.exports = {
1212
module: {
1313
loaders: [{
1414
test: /\.css$/,
15-
loader: ExtractTextPlugin.extract('style-loader', 'css-loader'),
15+
loader: ExtractTextPlugin.extract.length !== 1 ?
16+
ExtractTextPlugin.extract('style-loader', 'css-loader') :
17+
ExtractTextPlugin.extract({
18+
fallbackLoader: 'style-loader',
19+
loader: 'css-loader',
20+
}),
1621
}],
1722
},
1823
devtool: 'source-map',

test/spec/index.spec.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ import {expect} from 'chai';
88
const basic = path.join('.', 'basic', 'index.js');
99
const less = path.join('.', 'less', 'index.js');
1010

11+
const extract = ExtractTextPlugin.extract.length !== 1 ?
12+
(a, b) => ExtractTextPlugin.extract(a, b) :
13+
(fallbackLoader, loader) => loader ? ExtractTextPlugin.extract({
14+
fallbackLoader,
15+
loader,
16+
}) : ExtractTextPlugin.extract({
17+
loader: fallbackLoader,
18+
});
19+
1120
const config = (options, entry = basic, extra) => {
1221
return {
1322
entry: path.join(__dirname, '..', '..', 'example', entry),
@@ -20,13 +29,13 @@ const config = (options, entry = basic, extra) => {
2029
module: {
2130
loaders: [{
2231
test: /\.css$/,
23-
loader: ExtractTextPlugin.extract(
32+
loader: extract(
2433
'style-loader',
2534
'css-loader?sourceMap'
2635
),
2736
}, {
2837
test: /\.less$/,
29-
loader: ExtractTextPlugin.extract(
38+
loader: extract(
3039
'css?-url&-autoprefixer&sourceMap!less?sourceMap'
3140
),
3241
}],

0 commit comments

Comments
 (0)