Skip to content
This repository was archived by the owner on Mar 5, 2022. It is now read-only.

Commit 750316f

Browse files
authored
fix: better load webpack config (#263)
should load functional webpack config
1 parent a58a3be commit 750316f

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
"@cypress/webpack-preprocessor": "5.4.1",
127127
"babel-plugin-istanbul": "6.0.0",
128128
"debug": "4.1.1",
129-
"find-webpack": "1.9.2",
129+
"find-webpack": "1.10.1",
130130
"mime-types": "2.1.26"
131131
},
132132
"release": {

plugins/load-webpack/index.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ module.exports = (on, config) => {
1616
}
1717
debug('got webpack config filename %s', webpackFilename)
1818
const resolved = path.resolve(webpackFilename)
19-
debug('resolved webpack at %s', webpackFilename)
20-
21-
let webpackOptions = require(resolved)
22-
debug('loaded webpack options: %o', webpackOptions)
23-
if (webpackOptions.default) {
24-
// we probably loaded TS file
25-
debug('loaded webpack options has .default - taking that as the config')
26-
webpackOptions = webpackOptions.default
19+
debug('resolved webpack at %s', resolved)
20+
21+
const webpackOptions = findWebpack.tryLoadingWebpackConfig(resolved)
22+
if (!webpackOptions) {
23+
throw new Error(`Could not load webpack config from ${resolved}`)
2724
}
2825

2926
debug('webpack options: %o', webpackOptions)

0 commit comments

Comments
 (0)