Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix($core): include polyfills correctly (close #1168) #2317

Merged
merged 4 commits into from
Apr 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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