File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
test/fixtures/buildDependencies Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -692,6 +692,11 @@ class SnapshotOptimization {
692
692
}
693
693
}
694
694
695
+ const parseString = str => {
696
+ if ( str [ 0 ] === "'" ) str = `"${ str . slice ( 1 , - 1 ) . replace ( / " / g, '\\"' ) } "` ;
697
+ return JSON . parse ( str ) ;
698
+ } ;
699
+
695
700
/* istanbul ignore next */
696
701
/**
697
702
* @param {number } mtime mtime
@@ -1657,17 +1662,13 @@ class FileSystemInfo {
1657
1662
let dependency ;
1658
1663
if ( imp . d === - 1 ) {
1659
1664
// import ... from "..."
1660
- dependency = JSON . parse (
1665
+ dependency = parseString (
1661
1666
source . substring ( imp . s - 1 , imp . e + 1 )
1662
1667
) ;
1663
1668
} else if ( imp . d > - 1 ) {
1664
1669
// import()
1665
1670
let expr = source . substring ( imp . s , imp . e ) . trim ( ) ;
1666
- if ( expr [ 0 ] === "'" )
1667
- expr = `"${ expr
1668
- . slice ( 1 , - 1 )
1669
- . replace ( / " / g, '\\"' ) } "`;
1670
- dependency = JSON . parse ( expr ) ;
1671
+ dependency = parseString ( expr ) ;
1671
1672
} else {
1672
1673
// e.g. import.meta
1673
1674
continue ;
Original file line number Diff line number Diff line change 1
1
export { default } from "./esm-dep.mjs" ;
2
+ // prettier-ignore
3
+ import './esm-dep.mjs' ;
2
4
3
5
export const asyncDep = (
4
6
await import ( "../../js/buildDepsInput/esm-async-dependency.mjs" )
5
7
) . default ;
8
+ // prettier-ignore
9
+ await import ( '../../js/buildDepsInput/esm-async-dependency.mjs' )
You can’t perform that action at this time.
0 commit comments