Skip to content

Commit 345509e

Browse files
Merge pull request #79 from faceyspacey/entry-as-function
fix(index.js): Read entry when its a function
2 parents 9230505 + aa66382 commit 345509e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0-placeholder",
44
"author": "James Gillmore <james@faceyspacey.com>",
55
"contributors": [
6-
"Zack Jackson <zackary.l.jackson@gmail.com> (https://github.com/zackljackson)"
6+
"Zack Jackson <zackary.l.jackson@gmail.com> (https://github.com/ScriptedAlchemy)"
77
],
88
"description": "Extract CSS from chunks into stylesheets + HMR. Supports Webpack 4",
99
"engines": {
@@ -47,7 +47,7 @@
4747
"travis": "npm run ci:coverage"
4848
},
4949
"peerDependencies": {
50-
"webpack": "^4.4.0"
50+
"webpack": "^4.8.3"
5151
},
5252
"dependencies": {
5353
"loader-utils": "^1.1.0",
@@ -85,7 +85,7 @@
8585
"pre-commit": "^1.2.2",
8686
"prettier": "^1.11.1",
8787
"standard-version": "^4.3.0",
88-
"webpack": "^4.4.0",
88+
"webpack": "4.8.3",
8989
"webpack-cli": "^2.0.13",
9090
"webpack-dev-server": "^3.1.1"
9191
},

src/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const isHMR = (compiler) => {
2424
}
2525

2626
if (compiler.options.entry) {
27-
const entryString = JSON.stringify(compiler.options.entry);
27+
const entry = typeof compiler.options.entry === 'function' ? compiler.options.entry() : compiler.options.entry;
28+
const entryString = JSON.stringify(entry);
2829
return entryString.includes('hot') || entryString.includes('hmr');
2930
}
3031
}

yarn.lock

+4-5
Original file line numberDiff line numberDiff line change
@@ -5138,7 +5138,7 @@ json-buffer@3.0.0:
51385138
version "3.0.0"
51395139
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898"
51405140

5141-
json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2:
5141+
json-parse-better-errors@^1.0.1:
51425142
version "1.0.2"
51435143
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
51445144

@@ -8620,9 +8620,9 @@ webpack-sources@^1.0.1, webpack-sources@^1.1.0:
86208620
source-list-map "^2.0.0"
86218621
source-map "~0.6.1"
86228622

8623-
webpack@^4.4.0:
8624-
version "4.9.1"
8625-
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.9.1.tgz#fa7bd738b17fd7f09f37da461b2f5c16c6565f34"
8623+
webpack@4.8.3:
8624+
version "4.8.3"
8625+
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.8.3.tgz#957c8e80000f9e5cc03d775e78b472d8954f4eeb"
86268626
dependencies:
86278627
"@webassemblyjs/ast" "1.4.3"
86288628
"@webassemblyjs/wasm-edit" "1.4.3"
@@ -8634,7 +8634,6 @@ webpack@^4.4.0:
86348634
chrome-trace-event "^0.1.1"
86358635
enhanced-resolve "^4.0.0"
86368636
eslint-scope "^3.7.1"
8637-
json-parse-better-errors "^1.0.2"
86388637
loader-runner "^2.3.0"
86398638
loader-utils "^1.1.0"
86408639
memory-fs "~0.4.1"

0 commit comments

Comments
 (0)