Skip to content

Commit 3f0d6e1

Browse files
authored
fix: add tw util for compatible versions and use unshift for module paths
1 parent 8280b27 commit 3f0d6e1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export default defineNuxtModule<ModuleOptions>({
153153
if (moduleOptions.editorSupport || moduleOptions.addTwUtil || isNuxt2()) {
154154
const editorSupportConfig = resolveEditorSupportConfig(moduleOptions.editorSupport)
155155

156-
if (editorSupportConfig.autocompleteUtil || moduleOptions.addTwUtil) {
156+
if ((editorSupportConfig.autocompleteUtil || moduleOptions.addTwUtil) && !isNuxt2()) {
157157
addImports({
158158
name: 'autocompleteUtil',
159159
from: resolve('./runtime/utils'),

src/resolvers.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ export const resolveModulePaths = async (configPath: ModuleOptions['configPath']
6767

6868
if (Array.isArray(nuxt.options._layers) && nuxt.options._layers.length > 1) {
6969
const layerPaths = await Promise.all(
70-
nuxt.options._layers.slice(1).reverse().map(async (layer): Promise<[string[], string[]]> => ([
70+
nuxt.options._layers.slice(1).map(async (layer): Promise<[string[], string[]]> => ([
7171
await resolveConfigPath(layer?.config?.tailwindcss?.configPath || join(layer.cwd, 'tailwind.config')),
7272
resolveContentPaths(layer?.config?.srcDir || layer.cwd, defu(layer.config, nuxt.options) as typeof nuxt.options)
7373
])))
7474

7575
layerPaths.forEach(([configPaths, contentPaths]) => {
76-
mainPaths[0].push(...configPaths)
77-
mainPaths[1].push(...contentPaths)
76+
mainPaths[0].unshift(...configPaths)
77+
mainPaths[1].unshift(...contentPaths)
7878
})
7979
}
8080

src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export type EditorSupportConfig = {
5353
/**
5454
* Enable utility to write Tailwind CSS classes inside strings.
5555
*
56-
* You will need to update `.vscode/settings.json` based on this value.
56+
* You will need to update `.vscode/settings.json` based on this value. This works only for Nuxt 3 or Nuxt 2 with Bridge.
5757
*
5858
* ```json
5959
* {

0 commit comments

Comments
 (0)