Skip to content

Commit 3c3274f

Browse files
committed
chore: update
1 parent d0afd23 commit 3c3274f

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

packages/core/src/config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,7 @@ const composeFormatConfig = ({
590590
// If nodeEnv is false, the process.env.NODE_ENV in third-party packages's will not be replaced
591591
optimization: {
592592
nodeEnv: 'production',
593-
moduleIds:
594-
process.env.NODE_ENV === 'production'
595-
? 'deterministic'
596-
: 'named',
593+
moduleIds: 'deterministic',
597594
},
598595
},
599596
},

packages/core/src/mf.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ function changeEnvToDev(rsbuildConfig: RsbuildConfig) {
4242
rspack: {
4343
optimization: {
4444
nodeEnv: 'development',
45+
moduleIds: 'named',
4546
},
4647
},
4748
},

tests/integration/minify/index.test.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,18 @@ test('tree shaking is disabled by the user, bar and baz should be kept', async (
2929
`);
3030
});
3131

32-
describe('mf build', () => {
33-
beforeEach(() => {
34-
vi.stubEnv('NODE_ENV', 'production');
35-
});
36-
37-
afterEach(() => {
38-
vi.unstubAllEnvs();
39-
});
40-
41-
test('minify is enabled by default in mf format, bar and baz should be minified', async () => {
42-
const fixturePath = join(__dirname, 'mf/default');
43-
const { mfExposeEntry } = await buildAndGetResults({ fixturePath });
44-
// biome-ignore format: snapshot
45-
expect(mfExposeEntry).toMatchInlineSnapshot(`""use strict";(globalThis["default_minify"]=globalThis["default_minify"]||[]).push([["249"],{163:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{foo:function(){return foo}});const foo=()=>{}}}]);"`);
46-
});
32+
test('minify is enabled by default in mf format, bar and baz should be minified', async () => {
33+
const fixturePath = join(__dirname, 'mf/default');
34+
const { mfExposeEntry } = await buildAndGetResults({ fixturePath });
35+
// biome-ignore format: snapshot
36+
expect(mfExposeEntry).toMatchInlineSnapshot(`""use strict";(globalThis["default_minify"]=globalThis["default_minify"]||[]).push([["249"],{163:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{foo:function(){return foo}});const foo=()=>{}}}]);"`);
37+
});
4738

48-
test('minify is disabled by the user, bar and baz should not be minified', async () => {
49-
const fixturePath = join(__dirname, 'mf/config');
50-
const { mfExposeEntry } = await buildAndGetResults({ fixturePath });
39+
test('minify is disabled by the user, bar and baz should not be minified', async () => {
40+
const fixturePath = join(__dirname, 'mf/config');
41+
const { mfExposeEntry } = await buildAndGetResults({ fixturePath });
5142

52-
expect(mfExposeEntry).toMatchInlineSnapshot(`""use strict";
43+
expect(mfExposeEntry).toMatchInlineSnapshot(`""use strict";
5344
(globalThis['disable_minify'] = globalThis['disable_minify'] || []).push([["249"], {
5445
"163": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5546
__webpack_require__.r(__webpack_exports__);
@@ -66,5 +57,4 @@ const baz = ()=>{
6657
}),
6758
6859
}]);"`);
69-
});
7060
});

0 commit comments

Comments
 (0)