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

feat: add support for TypeScript based configs #632

Merged
merged 8 commits into from
Apr 3, 2023
6 changes: 3 additions & 3 deletions test/fixtures/config-autoload/ts/array/postcss.config.cts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Config } from 'postcss-load-config';
import type { Config as PostCSSConfig } from 'postcss-load-config';
import { Configuration as WebpackConfig } from 'webpack';

module.exports = function (api: Config) {
module.exports = function (api: WebpackConfig): PostCSSConfig {
return {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it should be https://github.com/webpack-contrib/postcss-loader/blob/master/src/utils.js#L152, it is mix of types, so I think we just need to add this to documents

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to update types in docs and we can merge + small example, thank you

parser: 'sugarss',
syntax: 'sugarss',
// FIXME: To confirm. Apparently there's no longer an available option `mode`?
map: api.mode === 'development' ? 'inline' : false,
from: './test/fixtures/config-autoload/js/object/index.css',
to: './test/fixtures/config-autoload/js/object/expect/index.css',
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/config-autoload/ts/object/postcss.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Config } from 'postcss-load-config';
import type { Config as PostCSSConfig } from 'postcss-load-config';
import { Configuration as WebpackConfig } from 'webpack';

const config = function (api: Config) {
const config = function (api: WebpackConfig): PostCSSConfig {
return {
parser: 'sugarss',
syntax: 'sugarss',
// FIXME: To confirm. Apparently there's no longer an available option `mode`?
map: api.mode === 'development' ? 'inline' : false,
from: './test/fixtures/config-autoload/js/object/index.css',
to: './test/fixtures/config-autoload/js/object/expect/index.css',
Expand Down