mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 09:33:54 +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 modes = ['client', 'server']
|
||||||
const modernPattern = new RegExp(`\\.(${modes.join('|')})\\.\\w+$`)
|
const modePattern = new RegExp(`\\.(${modes.join('|')})\\.\\w+$`)
|
||||||
pluginFiles[0].replace(modernPattern, (_, mode) => {
|
pluginFiles[0].replace(modePattern, (_, mode) => {
|
||||||
// mode in nuxt.config has higher priority
|
// mode in nuxt.config has higher priority
|
||||||
if (p.mode === 'all' && modes.includes(mode)) {
|
if (p.mode === 'all' && modes.includes(mode)) {
|
||||||
p.mode = mode
|
p.mode = mode
|
||||||
|
@ -66,15 +66,15 @@ export class WebpackBundler {
|
|||||||
clientConfig.resolve.alias[p.name] = p.mode === 'server' ? './empty.js' : p.src
|
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
|
// Server config
|
||||||
if (serverConfig && !serverConfig.resolve.alias[p.name]) {
|
if (serverConfig && !serverConfig.resolve.alias[p.name]) {
|
||||||
serverConfig.resolve.alias[p.name] = p.mode === 'client' ? './empty.js' : p.src
|
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
|
// Check styleResource existence
|
||||||
|
Loading…
Reference in New Issue
Block a user