This repository was archived by the owner on Oct 1, 2025. It is now read-only.
Support for specifying plugins in Array #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
I got a build error when using the followings.
The error is as follows.
Cause
In my
nuxt.config.js, I was specifyingbuild.postcss.pluginsas an array.On the other hand, @nuxt/postcss8 uses object as value of
build.postcss.plugins.My
nuxt.config.jsis like the following.@nuxt/postcss8usesdefuto merge the settings.When
defumerges an object against an array, it uses the array index as the object's key.Thus,
defuwould buildbuild.postcss.pluginslike the following.You can reproduce this by checking out a57775a and then running
yarn dev.Solution
Select the format corresponding to
build.postcss.pluginsas defined innuxt.config.js. Ifbuild.postcss.pluginsis an array, use array format, if it is an object, use object format to merge (06f3bee).Test
yarn testyarn devyarn dev:legacyNotes.
Jest.src/index.tsand run the test,TypeError: defu_1.default is not a functiongotten.dist/index.jsin the test.dev:legacybecause we wanted to check the behavior with two differentnuxt.config.js.postcss-loaderdeprecates the object format, I named the configuration using the object format aslegacy.