Skip to content

Commit 781e37a

Browse files
committed
fix: prioritize own deps + avoid serving wrong index.html (fix #69)
1 parent 63816c1 commit 781e37a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/dev.js

+4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
9090
}
9191
})
9292

93+
const nonExistentDir = path.resolve(__dirname, 'non-existent')
9394
await serve({
95+
// avoid project cwd from being served. Otherwise if the user has index.html
96+
// in cwd it would break the server
97+
content: [nonExistentDir],
9498
compiler,
9599
host: process.env.DEBUG ? '0.0.0.0' : 'localhost',
96100
dev: { logLevel: 'warn' },

lib/webpack/createBaseConfig.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ module.exports = function createBaseConfig ({
4444
.merge(['.js', '.jsx', '.vue', '.json'])
4545
.end()
4646
.modules
47-
.add('node_modules')
48-
.add(path.resolve(sourceDir, '../node_modules'))
47+
// prioritize our own
4948
.add(path.resolve(__dirname, '../../node_modules'))
49+
.add('node_modules')
5050

5151
config.resolveLoader
5252
.set('symlinks', true)
5353
.modules
54-
.add('node_modules')
55-
.add(path.resolve(sourceDir, '../node_modules'))
54+
// prioritize our own
5655
.add(path.resolve(__dirname, '../../node_modules'))
56+
.add('node_modules')
5757

5858
config.module
5959
.noParse(/^(vue|vue-router|vuex|vuex-router-sync)$/)

0 commit comments

Comments
 (0)