Skip to content

feat!: move config output.syntax to syntax #169

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

Merged
merged 1 commit into from
Sep 2, 2024
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
8 changes: 4 additions & 4 deletions e2e/cases/syntax/config/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ import { defineConfig } from '@rslib/core';
export default defineConfig({
lib: [
generateBundleEsmConfig({
syntax: 'es2015',
output: {
distPath: { root: 'dist/esm/0' },
syntax: 'es2015',
},
}),
generateBundleEsmConfig({
syntax: ['es2022'],
output: {
distPath: { root: 'dist/esm/1' },
syntax: ['es2022'],
},
}),
generateBundleCjsConfig({
syntax: ['node 20'],
output: {
distPath: { root: 'dist/cjs/0' },
syntax: ['node 20'],
},
}),
generateBundleCjsConfig({
syntax: ['node 20', 'es5'],
output: {
distPath: { root: 'dist/cjs/1' },
syntax: ['node 20', 'es5'],
},
}),
],
Expand Down
4 changes: 1 addition & 3 deletions packages/core/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ export default defineConfig({
lib: [
{
format: 'esm',
output: {
syntax: ['node 16'],
},
syntax: ['node 16'],
dts: {
bundle: false,
distPath: './dist-types',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ async function composeLibRsbuildConfig(config: LibConfig, configPath: string) {
const bundleConfig = composeBundleConfig(jsExtension, config.bundle);
const targetConfig = composeTargetConfig(config.output?.target);
const syntaxConfig = composeSyntaxConfig(
config.output?.syntax,
config?.syntax,
config.output?.target,
);
const autoExternalConfig = composeAutoExternalConfig({
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/types/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ export interface LibConfig extends RsbuildConfig {
format?: Format;
autoExtension?: boolean;
autoExternal?: AutoExternal;
output?: RsbuildConfig['output'] & {
/** Support esX and browserslist query */
syntax?: Syntax;
};
/** Support esX and browserslist query */
syntax?: Syntax;
dts?: Dts;
}

Expand Down
4 changes: 1 addition & 3 deletions packages/core/tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,7 @@ describe('syntax', () => {
const rslibConfig: RslibConfig = {
lib: [
{
output: {
syntax: 'es2015',
},
syntax: 'es2015',
format: 'esm',
},
],
Expand Down
Loading