Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#451: Fallback to using webpack version instead of package.json version #452

Merged
merged 2 commits into from
Apr 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(utils): use webpack object version if package can't be required
  • Loading branch information
LuudJanssen committed Apr 21, 2021
commit 8d101cfc090cd69353e50a4f6046469f9b56314a
5 changes: 3 additions & 2 deletions lib/utils/is-webpack-1.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const webpackPkg = require('webpack/package.json');
const webpackPkg = require("webpack/package.json") || {};
const webpackVersion = webpackPkg.version || require("webpack").version;

const webpackMajorVersion = parseInt(webpackPkg.version.split('.')[0], 10);
const webpackMajorVersion = parseInt(webpackVersion.split(".")[0], 10);

module.exports = webpackMajorVersion === 1;