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
12 changes: 12 additions & 0 deletions e2e/cases/assets/custom-dist-path-string/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { expect, test } from '@e2e/helper';

test('should set `output.distPath` to a string', async ({ build }) => {
const rsbuild = await build();
const files = rsbuild.getDistFiles();
const filenames = Object.keys(files);
expect(
filenames.some((filename) =>
filename.includes('dist-custom/static/js/index.js'),
),
).toBeTruthy();
});
8 changes: 8 additions & 0 deletions e2e/cases/assets/custom-dist-path-string/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from '@rsbuild/core';

export default defineConfig({
output: {
filenameHash: false,
distPath: 'dist-custom',
},
});
1 change: 1 addition & 0 deletions e2e/cases/assets/custom-dist-path-string/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// empty
6 changes: 1 addition & 5 deletions e2e/cases/assets/emit-assets/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ export default defineConfig({
filenameHash: false,
},
environments: {
web: {
output: {
target: 'web',
},
},
web: {},
node: {
output: {
target: 'node',
Expand Down
4 changes: 1 addition & 3 deletions e2e/cases/cli/config-loader/rsbuild.config.auto.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import distPathJson from './path.json';

export default {
output: {
distPath: {
root: distPathJson.distPath,
},
distPath: distPathJson.distPath,
},
} satisfies RsbuildConfig;
4 changes: 1 addition & 3 deletions e2e/cases/cli/config-loader/rsbuild.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import type { RsbuildConfig } from '@rsbuild/core';

export default {
output: {
distPath: {
root: 'dist-custom',
},
distPath: 'dist-custom',
},
} satisfies RsbuildConfig;
4 changes: 1 addition & 3 deletions e2e/cases/cli/custom-config/custom.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { defineConfig } from '@rsbuild/core';

export default defineConfig({
output: {
distPath: {
root: 'dist-custom',
},
distPath: 'dist-custom',
},
});
4 changes: 1 addition & 3 deletions e2e/cases/cli/function-config/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { defineConfig } from '@rsbuild/core';

export default defineConfig(({ env, command }) => ({
output: {
distPath: {
root: `dist-${env}-${command}`,
},
distPath: `dist-${env}-${command}`,
},
}));
4 changes: 1 addition & 3 deletions e2e/cases/cli/load-import-meta-env/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { defineConfig } from '@rsbuild/core';

export default defineConfig({
output: {
distPath: {
root: `dist/${import.meta.env.FOO}`,
},
distPath: `dist/${import.meta.env.FOO}`,
},
});
4 changes: 1 addition & 3 deletions e2e/cases/cli/load-node-env/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { defineConfig } from '@rsbuild/core';

export default defineConfig({
output: {
distPath: {
root: `dist/${process.env.NODE_ENV}`,
},
distPath: `dist/${process.env.NODE_ENV}`,
},
});
4 changes: 1 addition & 3 deletions e2e/cases/cli/load-process-env/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { defineConfig } from '@rsbuild/core';

export default defineConfig({
output: {
distPath: {
root: `dist/${process.env.FOO}`,
},
distPath: `dist/${process.env.FOO}`,
},
});
4 changes: 1 addition & 3 deletions e2e/cases/cli/node-env/rsbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { defineConfig } from '@rsbuild/core';

export default defineConfig({
output: {
distPath: {
root: process.env.NODE_ENV === 'production' ? 'dist-prod' : 'dist-dev',
},
distPath: process.env.NODE_ENV === 'production' ? 'dist-prod' : 'dist-dev',
},
});
9 changes: 1 addition & 8 deletions e2e/cases/cli/reload-config/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ rspackTest(
dev: {
writeToDisk: true,
},
output: {
distPath: {
root: 'dist',
},
},
server: { port: ${await getRandomPort()} }
};`,
);
Expand All @@ -40,9 +35,7 @@ rspackTest(
writeToDisk: true,
},
output: {
distPath: {
root: 'dist-2',
},
distPath: 'dist-2',
},
server: { port: ${await getRandomPort()} }
};`,
Expand Down
8 changes: 2 additions & 6 deletions e2e/cases/cli/specified-environment/rsbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ export default defineConfig({
environments: {
web1: {
output: {
distPath: {
root: 'dist/web1',
},
distPath: 'dist/web1',
},
},
web2: {
output: {
distPath: {
root: 'dist/web2',
},
distPath: 'dist/web2',
},
},
},
Expand Down
8 changes: 2 additions & 6 deletions e2e/cases/config/debug-mode/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ test('should generate config files in debug mode when build', async ({
const rsbuild = await build({
config: {
output: {
distPath: {
root: distRoot,
},
distPath: distRoot,
},
},
});
Expand All @@ -52,9 +50,7 @@ test('should generate config files in debug mode when dev', async ({
const rsbuild = await dev({
config: {
output: {
distPath: {
root: distRoot,
},
distPath: distRoot,
},
},
page,
Expand Down
6 changes: 1 addition & 5 deletions e2e/cases/config/inspect-config/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ rspackTest(
cwd: __dirname,
config: {
environments: {
web: {
output: {
target: 'web',
},
},
web: {},
node: {
output: {
target: 'node',
Expand Down
12 changes: 2 additions & 10 deletions e2e/cases/environments/basic/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ test('should build successfully with multiple environments', async ({
await buildPreview({
config: {
environments: {
web: {
output: {
target: 'web',
},
},
web: {},
node: {
output: {
target: 'node',
Expand All @@ -32,11 +28,7 @@ test('should serve successfully in dev with multiple environments', async ({
await dev({
config: {
environments: {
web: {
output: {
target: 'web',
},
},
web: {},
node: {
output: {
target: 'node',
Expand Down
4 changes: 1 addition & 3 deletions e2e/cases/environments/build-custom-dist/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export default defineConfig({
web1: {
output: {
filenameHash: false,
distPath: {
root: 'dist/web1',
},
distPath: 'dist/web1',
},
},
},
Expand Down
4 changes: 1 addition & 3 deletions e2e/cases/environments/plugins/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export default defineConfig({
output: {
assetPrefix: 'auto',
filenameHash: false,
distPath: {
root: 'dist/web1',
},
distPath: 'dist/web1',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export default defineConfig({
},
},
output: {
distPath: {
root: 'dist/web1',
},
distPath: 'dist/web1',
},
},
web2: {
Expand All @@ -30,9 +28,7 @@ export default defineConfig({
},
},
output: {
distPath: {
root: 'dist/web2',
},
distPath: 'dist/web2',
},
},
},
Expand Down
4 changes: 1 addition & 3 deletions e2e/cases/output/clean-dist-path/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ test('should not clean dist path if it is outside root', async ({ build }) => {
const rsbuild = await build({
config: {
output: {
distPath: {
root: '../node_modules',
},
distPath: '../node_modules',
},
},
});
Expand Down
12 changes: 3 additions & 9 deletions e2e/cases/output/copy/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ test('should copy asset to dist folder correctly', async ({ build }) => {
await build({
config: {
output: {
distPath: {
root: 'dist-1',
},
distPath: 'dist-1',
copy: [{ from: '../../../assets' }],
},
},
Expand Down Expand Up @@ -39,9 +37,7 @@ test('should copy asset to dist sub-folder correctly', async ({ build }) => {
await build({
config: {
output: {
distPath: {
root: 'dist-1',
},
distPath: 'dist-1',
copy: [{ from: '../../../assets', to: 'foo' }],
},
},
Expand Down Expand Up @@ -90,9 +86,7 @@ test('should merge copy config correctly', async ({ build }) => {
await build({
config: {
output: {
distPath: {
root: 'dist-4',
},
distPath: 'dist-4',
},
plugins: [rsbuildPlugin(), rsbuildPlugin2()],
},
Expand Down
8 changes: 2 additions & 6 deletions e2e/cases/output/manifest/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ test('should generate manifest file when target is node', async ({ build }) => {
const rsbuild = await build({
config: {
output: {
distPath: {
root: 'dist-1',
},
distPath: 'dist-1',
target: 'node',
manifest: true,
filenameHash: false,
Expand Down Expand Up @@ -97,9 +95,7 @@ test('should always write manifest to disk when in dev', async ({ dev }) => {
const rsbuild = await dev({
config: {
output: {
distPath: {
root: 'dist-dev',
},
distPath: 'dist-dev',
manifest: true,
filenameHash: false,
},
Expand Down
6 changes: 1 addition & 5 deletions e2e/cases/plugin-api/plugin-after-build-hook/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ rspackTest(
config: {
plugins: [plugin],
environments: {
web: {
output: {
target: 'web',
},
},
web: {},
node: {
output: {
target: 'node',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ export default defineConfig({
environments: {
web: {
output: {
target: 'web',
filenameHash: false,
},
},
node: {
output: {
target: 'node',
distPath: {
root: 'dist/server',
},
distPath: 'dist/server',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ import { myPlugin } from './myPlugin';
export default {
plugins: [myPlugin],
environments: {
web: {
output: {
target: 'web',
},
},
web: {},
node: {
output: {
target: 'node',
distPath: {
root: 'dist/server',
},
distPath: 'dist/server',
},
},
},
Expand Down
Loading
Loading