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
4 changes: 0 additions & 4 deletions examples/react-component-bundle/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export default defineConfig({
output: {
distPath: {
root: './dist/esm',
css: '.',
cssAsync: '.',
},
},
},
Expand All @@ -21,8 +19,6 @@ export default defineConfig({
output: {
distPath: {
root: './dist/cjs',
css: '.',
cssAsync: '.',
},
},
},
Expand Down
11 changes: 1 addition & 10 deletions examples/vue-component-bundle/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ import { defineConfig } from '@rslib/core';

export default defineConfig({
plugins: [pluginVue()],
lib: [
{
format: 'esm',
output: {
distPath: {
css: '.',
},
},
},
],
lib: [{ format: 'esm' }],
output: {
target: 'web',
},
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ export async function createConstantRsbuildConfig(): Promise<RsbuildConfig> {
filenameHash: false,
distPath: {
js: './',
jsAsync: './',
css: './',
cssAsync: './',
},
},
});
Expand Down
9 changes: 9 additions & 0 deletions packages/core/tests/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1
"mode": "production",
"output": {
"distPath": {
"css": "./",
"cssAsync": "./",
"js": "./",
"jsAsync": "./",
},
"externals": [
[Function],
Expand Down Expand Up @@ -239,7 +242,10 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1
"mode": "production",
"output": {
"distPath": {
"css": "./",
"cssAsync": "./",
"js": "./",
"jsAsync": "./",
},
"externals": [
"assert",
Expand Down Expand Up @@ -464,7 +470,10 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1
"mode": "production",
"output": {
"distPath": {
"css": "./",
"cssAsync": "./",
"js": "./",
"jsAsync": "./",
},
"externals": [
"assert",
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/style/css-modules/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ test('should extract css-modules successfully in bundle', async () => {
const esmFiles = Object.keys(contents.esm);
expect(esmFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/css-modules/bundle/dist/esm/static/css/index.css",
"<ROOT>/tests/integration/style/css-modules/bundle/dist/esm/index.css",
]
`);

const cjsFiles = Object.keys(contents.cjs);
expect(cjsFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/css-modules/bundle/dist/cjs/static/css/index.css",
"<ROOT>/tests/integration/style/css-modules/bundle/dist/cjs/index.css",
]
`);
});
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/style/css/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ test('should extract css successfully in bundle', async () => {

expect(files.esm).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/css/bundle/dist/esm/static/css/index.css",
"<ROOT>/tests/integration/style/css/bundle/dist/esm/index.css",
]
`);

expect(contents.esm).toMatchInlineSnapshot(`
{
"<ROOT>/tests/integration/style/css/bundle/dist/esm/static/css/index.css": "@import url(https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/1.1.0/modern-normalize.css);
"<ROOT>/tests/integration/style/css/bundle/dist/esm/index.css": "@import url(https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/1.1.0/modern-normalize.css);
@import url(https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/1.0.0/modern-normalize.css);
.lib1 {
color: red;
Expand All @@ -37,13 +37,13 @@ test('should extract css successfully in bundle', async () => {

expect(files.cjs).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/css/bundle/dist/cjs/static/css/index.css",
"<ROOT>/tests/integration/style/css/bundle/dist/cjs/index.css",
]
`);

expect(contents.cjs).toMatchInlineSnapshot(`
{
"<ROOT>/tests/integration/style/css/bundle/dist/cjs/static/css/index.css": "@import url(https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/1.1.0/modern-normalize.css);
"<ROOT>/tests/integration/style/css/bundle/dist/cjs/index.css": "@import url(https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/1.1.0/modern-normalize.css);
@import url(https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/1.0.0/modern-normalize.css);
.lib1 {
color: red;
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/style/less/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ test('should extract css with pluginLess successfully in bundle', async () => {
const esmFiles = Object.keys(contents.esm);
expect(esmFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/less/bundle/dist/esm/static/css/index.css",
"<ROOT>/tests/integration/style/less/bundle/dist/esm/index.css",
]
`);

const cjsFiles = Object.keys(contents.cjs);
expect(cjsFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/less/bundle/dist/cjs/static/css/index.css",
"<ROOT>/tests/integration/style/less/bundle/dist/cjs/index.css",
]
`);
});
Expand All @@ -52,15 +52,15 @@ test('should extract css with pluginLess successfully in import case', async ()
const esmFiles = Object.keys(contents.esm);
expect(esmFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/less/bundle-import/dist/esm/static/css/index.css",
"<ROOT>/tests/integration/style/less/bundle-import/dist/esm/index.css",
]
`);
expectFileContainContent(contents.esm, 'index.css', '.lib1 {');

const cjsFiles = Object.keys(contents.cjs);
expect(cjsFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/less/bundle-import/dist/cjs/static/css/index.css",
"<ROOT>/tests/integration/style/less/bundle-import/dist/cjs/index.css",
]
`);
expectFileContainContent(contents.cjs, 'index.css', '.lib1 {');
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/style/lightningcss/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test('should extract css with lightningcss-loader successfully in bundle', async
const esmFiles = Object.keys(contents.esm);
expect(esmFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/lightningcss/bundle/dist/esm/static/css/index.css",
"<ROOT>/tests/integration/style/lightningcss/bundle/dist/esm/index.css",
]
`);
expectFileContainContent(
Expand All @@ -21,7 +21,7 @@ test('should extract css with lightningcss-loader successfully in bundle', async
const cjsFiles = Object.keys(contents.cjs);
expect(cjsFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/lightningcss/bundle/dist/cjs/static/css/index.css",
"<ROOT>/tests/integration/style/lightningcss/bundle/dist/cjs/index.css",
]
`);
expectFileContainContent(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/style/postcss/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ test('should extract css with postcss-loader successfully in bundle', async () =
const esmFiles = Object.keys(contents.esm);
expect(esmFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/postcss/bundle/dist/esm/static/css/index.css",
"<ROOT>/tests/integration/style/postcss/bundle/dist/esm/index.css",
]
`);
expectFileContainContent(contents.esm, 'index.css', 'font-size: 16px;');

const cjsFiles = Object.keys(contents.cjs);
expect(cjsFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/postcss/bundle/dist/cjs/static/css/index.css",
"<ROOT>/tests/integration/style/postcss/bundle/dist/cjs/index.css",
]
`);
expectFileContainContent(contents.cjs, 'index.css', 'font-size: 16px;');
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/style/sass/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ test('should extract css with pluginSass in bundle', async () => {
const esmFiles = Object.keys(contents.esm);
expect(esmFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/sass/bundle/dist/esm/static/css/index.css",
"<ROOT>/tests/integration/style/sass/bundle/dist/esm/index.css",
]
`);

const cjsFiles = Object.keys(contents.cjs);
expect(cjsFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/sass/bundle/dist/cjs/static/css/index.css",
"<ROOT>/tests/integration/style/sass/bundle/dist/cjs/index.css",
]
`);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/style/tailwindcss/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test('should extract css when using tailwindcss successfully in bundle', async (
const esmFiles = Object.keys(contents.esm);
expect(esmFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/tailwindcss/bundle/dist/esm/static/css/index.css",
"<ROOT>/tests/integration/style/tailwindcss/bundle/dist/esm/index.css",
]
`);
expectFileContainContent(contents.esm, 'index.css', [
Expand All @@ -21,7 +21,7 @@ test('should extract css when using tailwindcss successfully in bundle', async (
const cjsFiles = Object.keys(contents.cjs);
expect(cjsFiles).toMatchInlineSnapshot(`
[
"<ROOT>/tests/integration/style/tailwindcss/bundle/dist/cjs/static/css/index.css",
"<ROOT>/tests/integration/style/tailwindcss/bundle/dist/cjs/index.css",
]
`);
expectFileContainContent(contents.cjs, 'index.css', [
Expand Down
Loading