Skip to content

Commit

Permalink
fix: only pick major part
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 27, 2020
1 parent 4424e9c commit 8ea0c3b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/webpack/src/config/base.js
Expand Up @@ -121,13 +121,14 @@ export default class WebpackBaseConfig {
if (corejsVersion === 'auto') {
try {
const r = createRequire(rootDir)
corejsVersion = (r('core-js') || {}).version || '2'
corejsVersion = ((r('core-js') || {}).version || '2').replace('.')[0]
} catch (_err) {
corejsVersion = '2'
}
}

if (corejsVersion !== '2' && corejsVersion !== '3') {
consola.warn('Invalid corejs version! Possible values are 2 and 3')
consola.warn(`Invalid corejs version ${JSON.stringify(corejsVersion)}! Possible values are 2 and 3`)
corejsVersion = '2'
}

Expand Down

0 comments on commit 8ea0c3b

Please sign in to comment.