mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
chore: warn when styleResources is used without the community module (#4302)
[skip ci]
This commit is contained in:
parent
18e613106b
commit
692493f5aa
@ -76,6 +76,12 @@ export class WebpackBundler {
|
||||
|
||||
// Check styleResource existence
|
||||
const styleResources = this.context.options.build.styleResources
|
||||
if (styleResources && Object.keys(styleResources).length) {
|
||||
consola.warn(
|
||||
'Using styleResources without the nuxt-style-resources-module is not suggested and can lead to severe performance issues.',
|
||||
'Please use https://github.com/nuxt-community/style-resources-module'
|
||||
)
|
||||
}
|
||||
Object.keys(styleResources).forEach(async (ext) => {
|
||||
await Promise.all(wrapArray(styleResources[ext]).map(async (p) => {
|
||||
const styleResourceFiles = await glob(path.resolve(this.context.options.rootDir, p))
|
||||
|
@ -14,13 +14,17 @@ const hooks = [
|
||||
|
||||
describe('with-config', () => {
|
||||
buildFixture('with-config', () => {
|
||||
expect(consola.warn).toHaveBeenCalledTimes(2)
|
||||
expect(consola.warn).toHaveBeenCalledTimes(3)
|
||||
expect(consola.fatal).toHaveBeenCalledTimes(0)
|
||||
expect(consola.warn.mock.calls).toMatchObject([
|
||||
[{
|
||||
message: 'Found 2 plugins that match the configuration, suggest to specify extension:',
|
||||
additional: expect.stringContaining('plugins/test.json')
|
||||
}],
|
||||
[
|
||||
'Using styleResources without the nuxt-style-resources-module is not suggested and can lead to severe performance issues.',
|
||||
'Please use https://github.com/nuxt-community/style-resources-module'
|
||||
],
|
||||
[
|
||||
'Notice: Please do not deploy bundles built with analyze mode, it\'s only for analyzing purpose.'
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user