fix: plugins for modern mode (#4659)

This commit is contained in:
Alexander Lichter 2018-12-30 15:28:42 +01:00 committed by Xin Du (Clark)
parent 8786ff7317
commit 867e8e1e84
2 changed files with 7 additions and 7 deletions

View File

@ -146,8 +146,8 @@ export default class Builder {
}
const modes = ['client', 'server']
const modernPattern = new RegExp(`\\.(${modes.join('|')})\\.\\w+$`)
pluginFiles[0].replace(modernPattern, (_, mode) => {
const modePattern = new RegExp(`\\.(${modes.join('|')})\\.\\w+$`)
pluginFiles[0].replace(modePattern, (_, mode) => {
// mode in nuxt.config has higher priority
if (p.mode === 'all' && modes.includes(mode)) {
p.mode = mode

View File

@ -66,15 +66,15 @@ export class WebpackBundler {
clientConfig.resolve.alias[p.name] = p.mode === 'server' ? './empty.js' : p.src
}
// Modern config
if (modernConfig && !modernConfig.resolve.alias[p.name]) {
modernConfig.resolve.alias[p.name] = p.mode === 'server' ? './empty.js' : p.src
}
// Server config
if (serverConfig && !serverConfig.resolve.alias[p.name]) {
serverConfig.resolve.alias[p.name] = p.mode === 'client' ? './empty.js' : p.src
}
// Modern config
if (modernConfig && !modernConfig.resolve.alias[p.name]) {
modernConfig.resolve.alias[p.name] = p.mode === 'client' ? './empty.js' : p.src
}
}
// Check styleResource existence