Skip to content

Commit 1bfdaae

Browse files
committed
chore: update test
1 parent fb4c4bf commit 1bfdaae

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

packages/core/src/css/cssConfig.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,13 @@ const pluginLibCss = (
141141
setup(api) {
142142
// 1. mark and remove the "normal css asset" (contain RSLIB_CSS_ENTRY_FLAG)
143143
// 2. preserve CSS Modules asset
144-
api.processAssets(
145-
{ stage: 'additional', targets: ['web', 'node'] },
146-
({ assets, compilation, environment }) => {
147-
for (const key of Object.keys(assets)) {
148-
console.log(key, 2222222, environment);
149-
if (key.match(RSLIB_CSS_ENTRY_FLAG)) {
150-
compilation.deleteAsset(key);
151-
}
144+
api.processAssets({ stage: 'additional' }, ({ assets, compilation }) => {
145+
for (const key of Object.keys(assets)) {
146+
if (key.match(RSLIB_CSS_ENTRY_FLAG)) {
147+
compilation.deleteAsset(key);
152148
}
153-
},
154-
);
149+
}
150+
});
155151

156152
api.modifyBundlerChain((config, { CHAIN_ID }) => {
157153
let isUsingCssExtract = false;

tests/integration/style/css/index.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,15 @@ test('should extract css successfully in bundle-false', async () => {
133133
}
134134
`);
135135
});
136+
137+
test('should not emit css and css related js in target: "node"', async () => {
138+
const fixturePath = join(__dirname, 'node-bundle-false');
139+
const { js, css, dts } = await buildAndGetResults({
140+
fixturePath,
141+
type: 'all',
142+
});
143+
144+
expect(js.files).toMatchInlineSnapshot('{}');
145+
expect(css.files).toMatchInlineSnapshot('{}');
146+
expect(dts.files).toMatchInlineSnapshot('{}');
147+
});

0 commit comments

Comments
 (0)