这是indexloc提供的服务,不要输入任何密码
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
2 changes: 1 addition & 1 deletion src/esbuild/postcss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const postcssPlugin = ({
}

// Transform CSS
const result = postcss
const result = await postcss
?.default(plugins)
.process(contents, { ...options, from: args.path })

Expand Down
5 changes: 5 additions & 0 deletions test/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -552,3 +552,8 @@ exports[`support baseUrl and paths in tsconfig.json in --dts-resolve build 1`] =
export { foo };
"
`;

exports[`support tailwindcss postcss plugin 1`] = `
"\\"use strict\\";
"
`;
23 changes: 23 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,29 @@ test('import css', async () => {
expect(outFiles).toEqual(['input.css', 'input.js'])
})

test('support tailwindcss postcss plugin', async () => {
const { output, outFiles } = await run(getTestName(), {
'input.ts': `
import './foo.css'
`,
'postcss.config.js': `
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
}
}
`,
'foo.css': `
@tailwind base;
@tailwind components;
@tailwind utilities;
`,
})
expect(output).toMatchSnapshot()
expect(outFiles).toEqual(['input.css', 'input.js'])
})

test('import css in --dts', async () => {
const { output, outFiles } = await run(
getTestName(),
Expand Down
2 changes: 2 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
"@egoist/path-parser": "1.0.4",
"@types/react": "17.0.50",
"@types/react-dom": "17.0.17",
"autoprefixer": "10.4.16",
"graphql": "^15.3.0",
"graphql-tools": "^5.0.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-select": "5.7.0",
"tailwindcss": "3.3.5",
"vue": "3.2.36",
"vue-router": "4.0.15"
},
Expand Down
Loading