Skip to content

Commit

Permalink
fix: browserslist query and rspack target (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework authored Aug 5, 2024
1 parent 36f2b29 commit b287f1e
Show file tree
Hide file tree
Showing 10 changed files with 565 additions and 305 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ The project is still in its early stages and under active development, so it pos

| Package | Link |
| ------------ | ------------------------------------------------------- |
| @rspack/core | [PR](https://github.com/web-infra-dev/rspack/pull/7210) |
| @rspack/core | [PR](https://github.com/web-infra-dev/rspack/pull/7394) |
1 change: 0 additions & 1 deletion e2e/cases/alias/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const a = 'hello world';
console.info(a);
export { a };
"
`;

Expand Down
28 changes: 24 additions & 4 deletions e2e/scripts/shared.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import { join } from 'node:path';
import { mergeRsbuildConfig as mergeConfig } from '@rsbuild/core';
import {
type InspectConfigResult,
type Rspack,
mergeRsbuildConfig as mergeConfig,
} from '@rsbuild/core';
import type { LibConfig, RslibConfig } from '@rslib/core';
import { globContentJSON } from '#helper';
import { build } from '../../packages/core/src/build';
import { loadConfig } from '../../packages/core/src/config';
import {
composeCreateRsbuildConfig,
loadConfig,
} from '../../packages/core/src/config';

export function generateBundleEsmConfig(
cwd: string,
Expand Down Expand Up @@ -103,15 +110,28 @@ export async function getResults(
export const buildAndGetResults = async (
fixturePath: string,
type: 'js' | 'dts' = 'js',
) => {
): Promise<{
contents: Record<string, Record<string, string>>;
files: Record<string, string[]>;
entries: Record<string, string>;
entryFiles: Record<string, string>;
rspackConfig: InspectConfigResult['origin']['bundlerConfigs'];
rsbuildConfig: InspectConfigResult['origin']['rsbuildConfig'];
}> => {
const rslibConfig = await loadConfig(join(fixturePath, 'rslib.config.ts'));
process.chdir(fixturePath);
await build(rslibConfig);
const rsbuildInstance = await build(rslibConfig);
const {
origin: { bundlerConfigs, rsbuildConfig },
} = await rsbuildInstance.inspectConfig({ verbose: true });

const results = await getResults(rslibConfig, fixturePath, type);
return {
contents: results.contents,
files: results.files,
entries: results.entries,
entryFiles: results.entryFiles,
rspackConfig: bundlerConfigs,
rsbuildConfig: rsbuildConfig,
};
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"pnpm": {
"overrides": {
"@rspack/core": "npm:@rspack/[email protected]d77b591-20240718094414"
"@rspack/core": "npm:@rspack/[email protected]338cfbe-20240731183605"
}
}
}
Loading

0 comments on commit b287f1e

Please sign in to comment.