Skip to content

Commit

Permalink
Merge pull request #791 from bendemboski/better-old-webpack-error
Browse files Browse the repository at this point in the history
Better error message with webpack v4 installed
  • Loading branch information
ef4 authored Apr 27, 2021
2 parents dfdadfd + 8e5a05b commit ffa2d39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"lodash": "^4.17.10",
"mini-css-extract-plugin": "^1.3.2",
"pkg-up": "^3.1.0",
"semver": "^7.3.5",
"source-map-url": "^0.4.0",
"style-loader": "^2.0.0",
"terser": "^5.5.1",
Expand Down
5 changes: 5 additions & 0 deletions packages/webpack/src/ember-webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { HTMLEntrypoint } from './html-entrypoint';
import { StatSummary } from './stat-summary';
import crypto from 'crypto';
import type { HbsLoaderConfig } from '@embroider/hbs-loader';
import semverSatisfies from 'semver/functions/satisfies';

const debug = makeDebug('embroider:debug');

Expand Down Expand Up @@ -83,6 +84,10 @@ const Webpack: Packager<Options> = class Webpack implements PackagerInstance {
private consoleWrite: (msg: string) => void,
options?: Options
) {
if (!semverSatisfies(webpack.version, '^5.0.0')) {
throw new Error(`@embroider/webpack requires webpack@^5.0.0, but found version ${webpack.version}`);
}

this.pathToVanillaApp = realpathSync(pathToVanillaApp);
this.extraConfig = options?.webpackConfig;
this.publicAssetURL = options?.publicAssetURL;
Expand Down

0 comments on commit ffa2d39

Please sign in to comment.