Skip to content

Commit 65910a0

Browse files
committed
test: fix exclude for cli-service dynamic entries
1 parent 3139228 commit 65910a0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/@vue/cli-plugin-babel/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,26 @@ module.exports = (api, {
44
}) => {
55
const useThreads = process.env.NODE_ENV === 'production' && parallel
66
const cacheDirectory = api.resolve('node_modules/.cache/cache-loader')
7+
const cliServicePath = require('path').dirname(require.resolve('@vue/cli-service'))
78

89
api.chainWebpack(webpackConfig => {
910
const jsRule = webpackConfig.module
1011
.rule('js')
1112
.test(/\.jsx?$/)
1213
.exclude
1314
.add(filepath => {
14-
// check if this is something the user explicitly wants to transpile
15-
if (transpileDependencies.some(dep => filepath.match(dep))) {
16-
return false
17-
}
1815
// always trasnpile js in vue files
1916
if (/\.vue\.jsx?$/.test(filepath)) {
2017
return false
2118
}
19+
// exclude dynamic entries from cli-service
20+
if (filepath.startsWith(cliServicePath)) {
21+
return true
22+
}
23+
// check if this is something the user explicitly wants to transpile
24+
if (transpileDependencies.some(dep => filepath.match(dep))) {
25+
return false
26+
}
2227
// Don't transpile node_modules
2328
return /node_modules/.test(filepath)
2429
})

0 commit comments

Comments
 (0)