Skip to content

Commit a402e77

Browse files
fix: logic
1 parent c2933f4 commit a402e77

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/dependencies/CachedConstDependency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ CachedConstDependency.Template = class CachedConstDependencyTemplate extends (
118118
`var ${dep.identifier} = ${dep.expression};\n`,
119119
InitFragment.STAGE_CONSTANTS,
120120
// For a chunk we inject expression after imports
121-
CachedConstDependency.PLACE_MODULE ? 0 : 1,
121+
dep.place === CachedConstDependency.PLACE_MODULE ? 0 : 10,
122122
`const ${dep.identifier}`
123123
)
124124
);

test/__snapshots__/ConfigCacheTestCases.longtest.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target
5353

5454
exports[`ConfigCacheTestCases chunks-order module exported tests The dependOn chunk must be loaded before the common chunk. 1`] = `
5555
"import {fileURLToPath as __webpack_fileURLToPath__} from \\"node:url\\";
56+
var __webpack_filename__ = __webpack_fileURLToPath__(import.meta.url);
5657
export const __webpack_esm_id__ = \\"foo\\";
5758
export const __webpack_esm_ids__ = [\\"foo\\"];
5859
export const __webpack_esm_modules__ = {
@@ -73,7 +74,6 @@ export const __webpack_esm_modules__ = {
7374
\\\\****************/
7475
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
7576
76-
var __webpack_filename__ = __webpack_fileURLToPath__(import.meta.url);
7777
/* harmony import */ var _style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./style.css */ 125);
7878
/* harmony import */ var _dependency_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dependency.js */ 784);
7979
/* harmony import */ var _dependency_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_dependency_js__WEBPACK_IMPORTED_MODULE_1__);
@@ -14998,10 +14998,10 @@ __WEBPACK_EXTERNAL_MODULE_externals1_v__;
1499814998
1499914999
exports[`ConfigCacheTestCases module import-meta-env exported tests import.meta.env behaves like process.env 1`] = `
1500015000
"import {fileURLToPath as __webpack_fileURLToPath__} from \\"url\\";
15001+
var __webpack_filename__ = __webpack_fileURLToPath__(import.meta.url);
1500115002
/*!******************!*\\\\
1500215003
!*** ./index.js ***!
1500315004
\\\\******************/
15004-
var __webpack_filename__ = __webpack_fileURLToPath__(import.meta.url);
1500515005
it(\\"should work import.meta.env with EnvironmentPlugin\\", () => {
1500615006
expect(\\"aaa\\").toBe(\\"aaa\\");
1500715007
});

test/__snapshots__/ConfigTestCases.basictest.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target
5353

5454
exports[`ConfigTestCases chunks-order module exported tests The dependOn chunk must be loaded before the common chunk. 1`] = `
5555
"import {fileURLToPath as __webpack_fileURLToPath__} from \\"node:url\\";
56+
var __webpack_filename__ = __webpack_fileURLToPath__(import.meta.url);
5657
export const __webpack_esm_id__ = \\"foo\\";
5758
export const __webpack_esm_ids__ = [\\"foo\\"];
5859
export const __webpack_esm_modules__ = {
@@ -73,7 +74,6 @@ export const __webpack_esm_modules__ = {
7374
\\\\****************/
7475
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
7576
76-
var __webpack_filename__ = __webpack_fileURLToPath__(import.meta.url);
7777
/* harmony import */ var _style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./style.css */ 125);
7878
/* harmony import */ var _dependency_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dependency.js */ 784);
7979
/* harmony import */ var _dependency_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_dependency_js__WEBPACK_IMPORTED_MODULE_1__);
@@ -13789,10 +13789,10 @@ __WEBPACK_EXTERNAL_MODULE_externals1_v__;
1378913789
1379013790
exports[`ConfigTestCases module import-meta-env exported tests import.meta.env behaves like process.env 1`] = `
1379113791
"import {fileURLToPath as __webpack_fileURLToPath__} from \\"url\\";
13792+
var __webpack_filename__ = __webpack_fileURLToPath__(import.meta.url);
1379213793
/*!******************!*\\\\
1379313794
!*** ./index.js ***!
1379413795
\\\\******************/
13795-
var __webpack_filename__ = __webpack_fileURLToPath__(import.meta.url);
1379613796
it(\\"should work import.meta.env with EnvironmentPlugin\\", () => {
1379713797
expect(\\"aaa\\").toBe(\\"aaa\\");
1379813798
});

0 commit comments

Comments
 (0)