Skip to content

Commit

Permalink
fix: Babel plugin should no longer require 'rootDir'
Browse files Browse the repository at this point in the history
  • Loading branch information
nmn committed Dec 21, 2024
1 parent 7f545cf commit 40233a6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion apps/nextjs-example/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module.exports = {
},
unstable_moduleResolution: {
type: 'commonJS',
rootDir: path.join(__dirname, '../..'),
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const defaultOpts = {
classNamePrefix,
};

// NOTE: While `rootDir` is optional now, It is needed in the
// test environment still.
const rootDir = '/stylex/packages/';

function transform(source, opts = defaultOpts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const defaultOpts = {
debug: false,
};

// NOTE: While `rootDir` is optional now, It is needed in the
// test environment still.
const rootDir = '/stylex/packages/';

function transform(source, opts = defaultOpts) {
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-plugin/src/utils/state-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type ImportPathResolution =
type ModuleResolution =
| $ReadOnly<{
type: 'commonJS',
rootDir?: string,
rootDir?: ?string,
themeFileExtension?: ?string,
}>
| $ReadOnly<{
Expand All @@ -53,7 +53,7 @@ type ModuleResolution =
const CheckModuleResolution: Check<ModuleResolution> = z.unionOf3(
z.object({
type: z.literal('commonJS'),
rootDir: z.string(),
rootDir: z.unionOf(z.nullish(), z.string()),
themeFileExtension: z.unionOf<null | void, string>(z.nullish(), z.string()),
}),
z.object({
Expand All @@ -75,7 +75,7 @@ export type StyleXOptions = $ReadOnly<{
runtimeInjection: boolean | ?string | $ReadOnly<{ from: string, as: string }>,
treeshakeCompensation?: boolean,
genConditionalClasses: boolean,
unstable_moduleResolution: ?ModuleResolution,
unstable_moduleResolution?: ?ModuleResolution,
aliases?: ?$ReadOnly<{ [string]: string | $ReadOnlyArray<string> }>,
...
}>;
Expand Down

0 comments on commit 40233a6

Please sign in to comment.