Skip to content

Commit

Permalink
Update manual tests for webpack 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnns committed Dec 27, 2016
1 parent 74d007b commit 9dcb4a8
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 50 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"should": "^11.1.0",
"style-loader": "^0.13.1",
"webpack": "^2.2.0-rc.2",
"webpack-dev-server": "^1.7.0",
"webpack-dev-server": "^2.2.0-rc.0",
"webpack-merge": "^2.0.0"
}
}
33 changes: 21 additions & 12 deletions test/bootstrapSass/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";

const path = require("path");

const pathToSassLoader = path.resolve(__dirname, "../../index.js");
const sassLoader = require.resolve("../../lib/loader");

module.exports = {
entry: path.resolve(__dirname, "../scss/bootstrap-sass.scss"),
Expand All @@ -12,15 +11,25 @@ module.exports = {
},
devtool: "inline-source-map",
module: {
loaders: [
{
test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/,
loader: "file"
},
{
test: /\.scss$/,
loader: "style-loader!css-loader!" + pathToSassLoader
}
]
rules: [{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: sassLoader,
options: {
includePaths: [
path.resolve(__dirname, "../scss/from-include-path")
]
}
}]
}, {
test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/,
use: [{
loader: "file-loader"
}]
}]
}
};
3 changes: 1 addition & 2 deletions test/hmr/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

/* global document */

require("../scss/language.scss");
require("./simple.css");
require("./simple.scss");

setInterval(() => {
document.body.innerHTML += "<br>Now we just change the DOM, so that we can ensure that webpack is not just reloading the page";
Expand Down
4 changes: 0 additions & 4 deletions test/hmr/simple.css

This file was deleted.

7 changes: 7 additions & 0 deletions test/hmr/simple.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$color: black;
$background: hotpink;

body {
color: $color;
background: $background;
}
29 changes: 10 additions & 19 deletions test/hmr/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"use strict";

const path = require("path");
const webpack = require("webpack");

const pathToSassLoader = path.resolve(__dirname, "../../index.js");
const sassLoader = require.resolve("../../lib/loader");

module.exports = {
entry: path.resolve(__dirname, "./entry.js"),
Expand All @@ -12,20 +10,13 @@ module.exports = {
filename: "bundle.hmr.js"
},
module: {
loaders: [
{
test: /\.scss$/,
loader: "style!css!" + pathToSassLoader
},
{
test: /\.css$/,
loader: "style!css"
}
]
},
debug: true,
watch: true,
plugins: [
new webpack.HotModuleReplacementPlugin()
]
rules: [{
test: /\.scss$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{ loader: sassLoader }
]
}]
}
};
15 changes: 11 additions & 4 deletions test/sourceMap/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";

const path = require("path");

const pathToSassLoader = path.resolve(__dirname, "../../index.js");
const sassLoader = require.resolve("../../lib/loader");

module.exports = {
entry: path.resolve(__dirname, "./entry.js"),
Expand All @@ -12,10 +11,18 @@ module.exports = {
},
devtool: "inline-source-map",
module: {
loaders: [
rules: [
{
test: /\.scss$/,
loaders: ["style", "css-loader?sourceMap", pathToSassLoader + "?sourceMap"]
use: [
{ loader: "style-loader" },
{ loader: "css-loader", options: {
sourceMap: true
} },
{ loader: sassLoader, options: {
sourceMap: true
} }
]
}
]
}
Expand Down
24 changes: 16 additions & 8 deletions test/watch/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";

const path = require("path");

const pathToSassLoader = path.resolve(__dirname, "../../index.js");
const sassLoader = require.resolve("../../lib/loader");

module.exports = {
entry: [
Expand All @@ -15,11 +14,20 @@ module.exports = {
},
watch: true,
module: {
loaders: [
{
test: /\.scss$/,
loader: "css-loader!" + pathToSassLoader + "?includePaths[]=" + encodeURIComponent(path.resolve(__dirname, "../scss/from-include-path"))
}
]
rules: [{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: sassLoader,
options: {
includePaths: [
path.resolve(__dirname, "../scss/from-include-path")
]
}
}]
}]
}
};

0 comments on commit 9dcb4a8

Please sign in to comment.