Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ensure `@plugin` resolves package JavaScript entries instead of browser CSS entries when using `@tailwindcss/vite` ([#19949](https://github.com/tailwindlabs/tailwindcss/pull/19949))
- Fix relative `@import` and `@plugin` paths resolving from the wrong directory when using `@tailwindcss/vite` ([#19965](https://github.com/tailwindlabs/tailwindcss/pull/19965))
- Ensure CSS files containing `@variant` are processed by `@tailwindcss/vite` ([#19966](https://github.com/tailwindlabs/tailwindcss/pull/19966))
- Resolve imports relative to `base` when `result.opts.from` is not provided when using `@tailwindcss/postcss` ([#19980](https://github.com/tailwindlabs/tailwindcss/pull/19980))

## [4.2.4] - 2026-04-21

Expand Down
10 changes: 10 additions & 0 deletions packages/@tailwindcss-postcss/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ describe('processing without specifying a base path', () => {
})
})

test('fallback to `base` directory when `result.opts.from` is not provided', async () => {
let processor = postcss([
tailwindcss({ base: `${__dirname}/fixtures/example-project`, optimize: { minify: false } }),
])

let result = await processor.process(`@import 'tailwindcss'`)

expect(result.css.length).toBeGreaterThan(0)
})

describe('plugins', () => {
test('local CJS plugin', async () => {
let processor = postcss([
Expand Down
2 changes: 1 addition & 1 deletion packages/@tailwindcss-postcss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin {
}

let context = getContextFromCache(postcss, inputFile, opts)
let inputBasePath = path.dirname(path.resolve(inputFile))
let inputBasePath = inputFile ? path.dirname(path.resolve(inputFile)) : base

// Whether this is the first build or not, if it is, then we can
// optimize the build by not creating the compiler until we need it.
Expand Down
Loading