mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(builder): corretly detect mode of hashed plugins (#5695)
This commit is contained in:
parent
28d9d46fa4
commit
67750245ab
@ -256,7 +256,7 @@ export default class Builder {
|
|||||||
|
|
||||||
normalizePlugins() {
|
normalizePlugins() {
|
||||||
const modes = ['client', 'server']
|
const modes = ['client', 'server']
|
||||||
const modePattern = new RegExp(`\\.(${modes.join('|')})(\\.\\w+)?$`)
|
const modePattern = new RegExp(`\\.(${modes.join('|')})(\\.\\w+)*$`)
|
||||||
return uniqBy(
|
return uniqBy(
|
||||||
this.options.plugins.map((p) => {
|
this.options.plugins.map((p) => {
|
||||||
if (typeof p === 'string') {
|
if (typeof p === 'string') {
|
||||||
|
@ -20,6 +20,7 @@ describe('builder: builder plugins', () => {
|
|||||||
const nuxt = createNuxt()
|
const nuxt = createNuxt()
|
||||||
nuxt.options.plugins = [
|
nuxt.options.plugins = [
|
||||||
'/var/nuxt/plugins/test.js',
|
'/var/nuxt/plugins/test.js',
|
||||||
|
'/var/nuxt/.nuxt/foo-bar.plugin.client.530b6c6a.js',
|
||||||
{ src: '/var/nuxt/plugins/test.server', mode: 'server' },
|
{ src: '/var/nuxt/plugins/test.server', mode: 'server' },
|
||||||
{ src: '/var/nuxt/plugins/test.client', ssr: false }
|
{ src: '/var/nuxt/plugins/test.client', ssr: false }
|
||||||
]
|
]
|
||||||
@ -33,6 +34,11 @@ describe('builder: builder plugins', () => {
|
|||||||
name: 'nuxt_plugin_test_hash(/var/nuxt/plugins/test.js)',
|
name: 'nuxt_plugin_test_hash(/var/nuxt/plugins/test.js)',
|
||||||
src: 'resolveAlias(/var/nuxt/plugins/test.js)'
|
src: 'resolveAlias(/var/nuxt/plugins/test.js)'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
mode: 'client',
|
||||||
|
name: 'nuxt_plugin_foobarpluginclient530b6c6a_hash(/var/nuxt/.nuxt/foo-bar.plugin.client.530b6c6a.js)',
|
||||||
|
src: 'resolveAlias(/var/nuxt/.nuxt/foo-bar.plugin.client.530b6c6a.js)'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
mode: 'server',
|
mode: 'server',
|
||||||
name: 'nuxt_plugin_test_hash(/var/nuxt/plugins/test.server)',
|
name: 'nuxt_plugin_test_hash(/var/nuxt/plugins/test.server)',
|
||||||
|
Loading…
Reference in New Issue
Block a user