Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit 7ee7850

Browse files
committed
Refactor watch-, sourceMap- and hmr-tests
1 parent 48c6328 commit 7ee7850

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

test/hmr/entry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
//require('../scss/language.scss');
3+
require('../scss/language.scss');
44
require('./simple.css');
55

66
setInterval(function () {
7-
document.body.innerHTML += '<br>this text should not suddenly disappear because the style is replaced on-the-fly';
7+
document.body.innerHTML += '<br>Now we just change the DOM, so that we can ensure that webpack is not just reloading the page';
88
}, 2000);

test/hmr/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
<script async src="/bundle.hmr.js"></script>
77
</head>
88
<body>
9-
<h1 class="another-module box">Now go change some files, dude!</h1>
9+
<h1 class="another-scss-module box">Now go change some files, dude!</h1>
1010
</body>
1111
</html>

test/hmr/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ module.exports = {
2424
]
2525
},
2626
debug: true,
27-
devtool: 'eval',
2827
watch: true,
2928
plugins: [
3029
new webpack.HotModuleReplacementPlugin()

test/sourceMap/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
<link href="/styles.sourcemap.css" type="text/css" rel="stylesheet">
77
</head>
88
<body>
9-
<h1 class="another-module box">Open the developer tools, dude!</h1>
9+
<h1 class="another-scss-module box">Open the developer tools, dude!</h1>
1010
</body>
1111
</html>

test/watch/entry.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
require('../scss/imports.scss');

test/watch/webpack.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ var path = require('path');
55
var pathToSassLoader = path.resolve(__dirname, '../../index.js');
66

77
module.exports = {
8-
entry: path.resolve(__dirname, '../sourceMap/entry.js'),
8+
entry: [
9+
path.resolve(__dirname, '../scss/imports.scss'),
10+
path.resolve(__dirname, '../scss/import-include-paths.scss')
11+
],
912
output: {
1013
path: path.resolve(__dirname, '../output'),
1114
filename: 'bundle.watch.js'
@@ -15,7 +18,7 @@ module.exports = {
1518
loaders: [
1619
{
1720
test: /\.scss$/,
18-
loader: 'css-loader!' + pathToSassLoader
21+
loader: 'css-loader!' + pathToSassLoader + '?includePaths[]=' + encodeURIComponent(path.resolve(__dirname, '../scss/from-include-path'))
1922
}
2023
]
2124
}

0 commit comments

Comments
 (0)