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

fix: fix empty object error #4903

Merged
merged 1 commit into from Sep 1, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugins/animation.js
Expand Up @@ -4,7 +4,7 @@ export default function () {
return function ({ matchUtilities, theme, variants, prefix }) {
let prefixName = (name) => prefix(`.${name}`).slice(1)
let keyframes = Object.fromEntries(
Object.entries(theme('keyframes')).map(([key, value]) => {
Object.entries(theme('keyframes') || {}).map(([key, value]) => {
return [
key,
[
Expand Down
2 changes: 1 addition & 1 deletion src/util/createUtilityPlugin.js
Expand Up @@ -36,7 +36,7 @@ export default function createUtilityPlugin(
{
values: filterDefault
? Object.fromEntries(
Object.entries(theme(themeKey)).filter(([modifier]) => modifier !== 'DEFAULT')
Object.entries(theme(themeKey) || {}).filter(([modifier]) => modifier !== 'DEFAULT')
)
: theme(themeKey),
variants: variants(themeKey),
Expand Down
2 changes: 1 addition & 1 deletion src/util/flattenColorPalette.js
@@ -1,7 +1,7 @@
const flattenColorPalette = (colors) =>
Object.assign(
{},
...Object.entries(colors).flatMap(([color, values]) =>
...Object.entries(colors || {}).flatMap(([color, values]) =>
typeof values == 'object'
? Object.entries(flattenColorPalette(values)).map(([number, hex]) => ({
[color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex,
Expand Down
2 changes: 1 addition & 1 deletion src/util/processPlugins.js
Expand Up @@ -109,7 +109,7 @@ export default function (plugins, config) {
prefix: applyConfiguredPrefix,
addUtilities,
matchUtilities: (matches, { values, variants, respectPrefix, respectImportant }) => {
let modifierValues = Object.entries(values)
let modifierValues = Object.entries(values || {})

let result = Object.entries(matches).flatMap(([name, utilityFunction]) => {
return modifierValues
Expand Down