Skip to content

Commit

Permalink
fix: prioritize own deps + avoid serving wrong index.html (fix #69)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 16, 2018
1 parent 63816c1 commit 781e37a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
}
})

const nonExistentDir = path.resolve(__dirname, 'non-existent')
await serve({
// avoid project cwd from being served. Otherwise if the user has index.html
// in cwd it would break the server
content: [nonExistentDir],
compiler,
host: process.env.DEBUG ? '0.0.0.0' : 'localhost',
dev: { logLevel: 'warn' },
Expand Down
8 changes: 4 additions & 4 deletions lib/webpack/createBaseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ module.exports = function createBaseConfig ({
.merge(['.js', '.jsx', '.vue', '.json'])
.end()
.modules
.add('node_modules')
.add(path.resolve(sourceDir, '../node_modules'))
// prioritize our own
.add(path.resolve(__dirname, '../../node_modules'))
.add('node_modules')

config.resolveLoader
.set('symlinks', true)
.modules
.add('node_modules')
.add(path.resolve(sourceDir, '../node_modules'))
// prioritize our own
.add(path.resolve(__dirname, '../../node_modules'))
.add('node_modules')

config.module
.noParse(/^(vue|vue-router|vuex|vuex-router-sync)$/)
Expand Down

0 comments on commit 781e37a

Please sign in to comment.