Skip to content

Commit 69c193a

Browse files
psalaetsmeteorlxy
andauthoredApr 27, 2020
fix($core): include polyfills correctly (close #1168) (#2317)
Co-Authored-By: meteorlxy <meteor.lxy@foxmail.com>
1 parent c80c36b commit 69c193a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed
 

‎packages/@vuepress/core/lib/node/webpack/createBaseConfig.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -137,22 +137,30 @@ module.exports = function createBaseConfig (context, isServer) {
137137
.rule('js')
138138
.test(/\.jsx?$/)
139139
.exclude.add(filePath => {
140-
// Always transpile lib directory
140+
// transpile lib directory
141141
if (filePath.startsWith(libDir)) {
142142
return false
143143
}
144-
// always transpile js in vue files and md files
144+
145+
// transpile js in vue files and md files
145146
if (/\.(vue|md)\.js$/.test(filePath)) {
146147
return false
147148
}
149+
148150
// transpile all core packages and vuepress related packages.
149151
// i.e.
150152
// @vuepress/*
151153
// vuepress-*
152154
if (/(@vuepress[\/\\][^\/\\]*|vuepress-[^\/\\]*)[\/\\](?!node_modules).*\.js$/.test(filePath)) {
153155
return false
154156
}
155-
// Don't transpile node_modules
157+
158+
// transpile @babel/runtime until fix for babel/babel#7597 is released
159+
if (filePath.includes(path.join('@babel', 'runtime'))) {
160+
return false
161+
}
162+
163+
// don't transpile node_modules
156164
return /node_modules/.test(filePath)
157165
}).end()
158166
.use('cache-loader')
@@ -171,7 +179,11 @@ module.exports = function createBaseConfig (context, isServer) {
171179
// ref: http://babeljs.io/docs/en/config-files
172180
configFile: false,
173181
presets: [
174-
require.resolve('@vue/babel-preset-app')
182+
[require.resolve('@vue/babel-preset-app'), {
183+
entryFiles: [
184+
path.resolve(__dirname, '../../client', isServer ? 'serverEntry.js' : 'clientEntry.js')
185+
]
186+
}]
175187
]
176188
})
177189
}

0 commit comments

Comments
 (0)
Please sign in to comment.