From 71875f0968b78c57d957e8d6cccbab4c5f32969f Mon Sep 17 00:00:00 2001 From: Paul Salaets Date: Fri, 17 Apr 2020 22:37:54 -0400 Subject: [PATCH 1/4] fix($core): specify entry files so the force-included polyfills will be included in the build output (fix #1168) --- .../@vuepress/core/lib/node/webpack/createBaseConfig.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js index bf7130b2db..1ad10f35f2 100644 --- a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js +++ b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js @@ -171,7 +171,12 @@ 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/clientEntry.js'), + path.resolve(__dirname, '../../client/serverEntry.js') + ] + }] ] }) } From 513f5596eead4b6bfc48413ab17e6894168240be Mon Sep 17 00:00:00 2001 From: Paul Salaets Date: Mon, 20 Apr 2020 08:31:23 -0400 Subject: [PATCH 2/4] Update packages/@vuepress/core/lib/node/webpack/createBaseConfig.js Co-Authored-By: meteorlxy --- packages/@vuepress/core/lib/node/webpack/createBaseConfig.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js index 1ad10f35f2..a531216fb1 100644 --- a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js +++ b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js @@ -173,8 +173,7 @@ module.exports = function createBaseConfig (context, isServer) { presets: [ [require.resolve('@vue/babel-preset-app'), { entryFiles: [ - path.resolve(__dirname, '../../client/clientEntry.js'), - path.resolve(__dirname, '../../client/serverEntry.js') + path.resolve(__dirname, '../../client', isServer ? 'serverEntry.js' : 'clientEntry.js') ] }] ] From 5c2a839b0eb43cdee3e28d9ac9c5ea5e56527e42 Mon Sep 17 00:00:00 2001 From: Paul Salaets Date: Fri, 24 Apr 2020 23:44:46 -0400 Subject: [PATCH 3/4] fix: @babel/runtime helpers use APIs not found in older environments --- .../@vuepress/core/lib/node/webpack/createBaseConfig.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js index a531216fb1..a5a20172f4 100644 --- a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js +++ b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js @@ -152,6 +152,12 @@ module.exports = function createBaseConfig (context, isServer) { if (/(@vuepress[\/\\][^\/\\]*|vuepress-[^\/\\]*)[\/\\](?!node_modules).*\.js$/.test(filePath)) { return false } + + // 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() From ac6a9f92f222b763206a8f509bd7741b43508bd4 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Mon, 27 Apr 2020 10:45:49 +0800 Subject: [PATCH 4/4] tweaks --- .../@vuepress/core/lib/node/webpack/createBaseConfig.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js index a5a20172f4..afbbb9449b 100644 --- a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js +++ b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js @@ -137,14 +137,16 @@ 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/* @@ -158,7 +160,7 @@ module.exports = function createBaseConfig (context, isServer) { return false } - // Don't transpile node_modules + // don't transpile node_modules return /node_modules/.test(filePath) }).end() .use('cache-loader')