Skip to content

Commit

Permalink
fix(ui): watch only locales folder if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed May 25, 2018
1 parent 873d14d commit 73a1c7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/@vue/cli-ui/src/graphql-api/connectors/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ function _loadFolder (root, context) {
}

function loadFolder (root, context) {
if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test' && !watchedTrees.get(root)) {
const folder = path.join(root, './locales')
if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test' && !watchedTrees.get(root) && fs.existsSync(folder)) {
watchedTrees.set(root, true)
const watch = require('watch')
watch.watchTree(root, () => {
watch.watchTree(folder, () => {
_loadFolder(root, context)
log('Locales reloaded', root)
})
Expand Down

0 comments on commit 73a1c7a

Please sign in to comment.