Skip to content

Commit

Permalink
Merge pull request #149 from nextcloud-libraries/dependabot/npm_and_y…
Browse files Browse the repository at this point in the history
…arn/vite-plugin-css-injected-by-js-3.5.0
  • Loading branch information
dependabot[bot] authored Apr 21, 2024
2 parents 9049a36 + 0ea9cec commit eb514c3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion __tests__/appconfig.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('app config', () => {
})

describe('inlining css', () => {
const pluginName = cssInjectedByJsPlugin().name
const pluginName = [cssInjectedByJsPlugin()].flat()[0].name

it('does not inline css by default', async () => {
const resolved = await createConfig()
Expand Down
12 changes: 9 additions & 3 deletions lib/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import type { UserConfig, UserConfigFn } from 'vite'
import type { Plugin, UserConfig, UserConfigFn } from 'vite'
import type { BaseOptions, NodePolyfillsOptions } from './baseConfig.js'

import { relative } from 'node:path'
Expand Down Expand Up @@ -83,10 +83,16 @@ export const createAppConfig = (entries: { [entryAlias: string]: string }, optio
// Make sure we get a user config and not a promise or a user config function
const userConfig = await Promise.resolve(typeof options.config === 'function' ? options.config(env) : options.config)

const plugins = []
const plugins = [] as Plugin[]
// Inject all imported styles into the javascript bundle by creating dynamic styles on the document
if (options.inlineCSS) {
plugins.push(injectCSSPlugin(typeof options.inlineCSS === 'object' ? options.inlineCSS : undefined))
const plugin = injectCSSPlugin({
dev: {
enableDev: env.mode === 'development',
},
...(typeof options.inlineCSS === 'object' ? options.inlineCSS : {}),
})
plugins.push(...[plugin].flat())
}

// defaults to true so only not adding if explicitly set to false
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"rollup-plugin-esbuild-minify": "^1.1.1",
"rollup-plugin-license": "^3.3.1",
"rollup-plugin-node-externals": "^7.1.1",
"vite-plugin-css-injected-by-js": "^3.3.1",
"vite-plugin-css-injected-by-js": "^3.5.0",
"vite-plugin-dts": "^3.8.3",
"vite-plugin-node-polyfills": "^0.21.0"
},
Expand Down

0 comments on commit eb514c3

Please sign in to comment.