Skip to content
This repository has been archived by the owner on Dec 6, 2021. It is now read-only.

Commit

Permalink
pass babelrc path to babel-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Jan 8, 2018
1 parent 0e25130 commit dcfa562
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/poi/lib/handle-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,33 @@ module.exports = co.wrap(function * (options) {
const externalBabelConfig = yield loadExternalConfig.babel(buildConfigChain)

if (externalBabelConfig) {
// If root babel config file is found
// We set `babelrc` to the its path
// To prevent `babel-loader` from loading it again
console.log('> Using external babel configuration')
console.log(
chalk.dim(`> location: "${tildify(externalBabelConfig.loc)}"`)
)
options.babel.babelrc = externalBabelConfig.options.babelrc !== false
// You can use `babelrc: false` to disable the config file itself
if (externalBabelConfig.options.babelrc === false) {
options.babel.babelrc = false
} else {
options.babel.babelrc = externalBabelConfig.loc
}
} else {
// If not found
// We set `babelrc` to `false` for the same reason
options.babel.babelrc = false
}

if (options.babel.babelrc === false) {
// Use our default preset when no babelrc was found
// Use our default preset when no babelrc was specified
options.babel.presets = [
[require.resolve('babel-preset-poi'), { jsx: options.jsx || 'vue' }]
]
}
}

if (typeof options.babel === 'object') {
options.babel.cacheDirectory = true
}
Expand Down

0 comments on commit dcfa562

Please sign in to comment.