File tree Expand file tree Collapse file tree 4 files changed +26
-0
lines changed
test/configCases/defer-import/same-module Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,16 @@ const ImportPhase = Object.freeze({
2727
2828/**
2929 * @typedef {object } ImportPhaseUtils
30+ * @property {(phase: ImportPhaseType) => boolean } isEvaluation true if phase is evaluation
3031 * @property {(phase: ImportPhaseType) => boolean } isDefer true if phase is defer
3132 * @property {(phase: ImportPhaseType) => boolean } isSource true if phase is source
3233 */
3334
3435/** @type {ImportPhaseUtils } */
3536const ImportPhaseUtils = {
37+ isEvaluation ( phase ) {
38+ return phase === ImportPhase . Evaluation ;
39+ } ,
3640 isDefer ( phase ) {
3741 return phase === ImportPhase . Defer ;
3842 } ,
Original file line number Diff line number Diff line change 1+ import * as mod1 from "./module.js" ;
2+ import defer * as mod2 from "./module.js" ;
3+
4+ it ( "should generate different runtime code for the same module" , ( ) => {
5+ expect ( mod1 . default ) . toBe ( mod2 . default ) ;
6+ expect ( mod1 ) . toBe ( mod2 ) ;
7+ // Test itself + module
8+ expect ( Object . keys ( __webpack_modules__ ) . length ) . toBe ( 2 ) ;
9+ } ) ;
Original file line number Diff line number Diff line change 1+ export default "ok" ;
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ /** @type {import("../../../../").Configuration } */
4+ module . exports = {
5+ target : [ `async-node${ process . versions . node . split ( "." ) . map ( Number ) [ 0 ] } ` ] ,
6+ optimization : {
7+ concatenateModules : false
8+ } ,
9+ experiments : {
10+ deferImport : true
11+ }
12+ } ;
You can’t perform that action at this time.
0 commit comments