chore: warn when styleResources is used without the community module (#4302)

[skip ci]
This commit is contained in:
Alexander Lichter 2018-11-09 23:59:40 +00:00 committed by Pooya Parsa
parent 18e613106b
commit 692493f5aa
2 changed files with 11 additions and 1 deletions

View File

@ -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))

View File

@ -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.'
]