Skip to content

Commit

Permalink
fix($core): include polyfills correctly (close vuejs#1168) (vuejs#2317)
Browse files Browse the repository at this point in the history
Co-Authored-By: meteorlxy <meteor.lxy@foxmail.com>
  • Loading branch information
2 people authored and Sergey Larionov committed Aug 19, 2020
1 parent b850256 commit 9b2ab84
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions packages/@vuepress/core/lib/node/webpack/createBaseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,30 @@ module.exports = function createBaseConfig (context, isServer) {
.rule('js')
.test(/\.jsx?$/)
.exclude.add(filePath => {
// Always transpile lib directory
// transpile lib directory
if (filePath.startsWith(libDir)) {
return false
}
// always transpile js in vue files and md files

// transpile js in vue files and md files
if (/\.(vue|md)\.js$/.test(filePath)) {
return false
}

// transpile all core packages and vuepress related packages.
// i.e.
// @vuepress/*
// vuepress-*
if (/(@vuepress[\/\\][^\/\\]*|vuepress-[^\/\\]*)[\/\\](?!node_modules).*\.js$/.test(filePath)) {
return false
}
// Don't transpile node_modules

// transpile @babel/runtime until fix for babel/babel#7597 is released
if (filePath.includes(path.join('@babel', 'runtime'))) {
return false
}

// don't transpile node_modules
return /node_modules/.test(filePath)
}).end()
.use('cache-loader')
Expand All @@ -171,7 +179,11 @@ module.exports = function createBaseConfig (context, isServer) {
// ref: http://babeljs.io/docs/en/config-files
configFile: false,
presets: [
require.resolve('@vue/babel-preset-app')
[require.resolve('@vue/babel-preset-app'), {
entryFiles: [
path.resolve(__dirname, '../../client', isServer ? 'serverEntry.js' : 'clientEntry.js')
]
}]
]
})
}
Expand Down

0 comments on commit 9b2ab84

Please sign in to comment.