Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/webpack/src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 5 additions & 1 deletion test/fixtures/with-config/with-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
]
Expand Down