mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix: plugins for modern mode (#4659)
This commit is contained in:
parent
8786ff7317
commit
867e8e1e84
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user