Skip to content

Commit

Permalink
fix: more global service resolve fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 26, 2018
1 parent e6b7278 commit 76dda73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions packages/@vue/cli-plugin-babel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ module.exports = api => {
options.loaders = options.loaders || {}
options.loaders.js = [
{
loader: 'cache-loader',
loader: require.resolve('cache-loader'),
options: { cacheDirectory }
},
'babel-loader'
{
loader: require.resolve('babel-loader')
}
]
return options
})
Expand Down
15 changes: 8 additions & 7 deletions packages/@vue/cli-service-global/lib/createConfigPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ module.exports = function createConfigPlugin (context, entry) {
// package managers their folder structures for global install.
// so we first resolve the location of vue and then trace to the
// install location.
const modulePath = path.resolve(require.resolve('vue'), '../../../')

config.resolve
.modules
.add(path.resolve(require.resolve('vue'), '../../../'))
.add(modulePath)

config.resolveLoader
.modules
.add(modulePath)

// set entry
config
Expand All @@ -43,12 +49,7 @@ module.exports = function createConfigPlugin (context, entry) {
.rule('vue')
.use('vue-loader')
.tap(options => {
options.loaders = Object.assign({
js: {
loader: 'babel-loader',
options: babelOptions
}
}, options.loaders)
options.loaders.js[1].options = babelOptions
return options
})

Expand Down

0 comments on commit 76dda73

Please sign in to comment.