File tree Expand file tree Collapse file tree
test/configCases/output/import-meta-name Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ class ImportMetaPlugin {
5252 const parserHandler = ( parser , { importMeta } ) => {
5353 if ( importMeta === false ) {
5454 const { importMetaName } = compilation . outputOptions ;
55+ if ( importMetaName === "import.meta" ) return ;
5556
5657 parser . hooks . expression
5758 . for ( "import.meta" )
Original file line number Diff line number Diff line change 1+ export const url = import . meta. url ;
Original file line number Diff line number Diff line change 1+ import { url } from "./a" ;
2+
3+ it ( "should evaluate import.meta to pseudoImport.meta" , ( ) => {
4+ expect ( url ) . toBe ( "http://test.co/path/index.js" ) ;
5+ } ) ;
6+
7+ it ( "should evaluate import.meta in runtime" , ( ) => {
8+ expect ( url ) . toBe ( import . meta. url ) ;
9+ } ) ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ moduleScope ( scope ) {
3+ scope . pseudoImport = { meta : { url : "http://test.co/path/index.js" } } ;
4+ }
5+ } ;
Original file line number Diff line number Diff line change 1+ /** @type {import("../../../../").Configuration } */
2+ module . exports = {
3+ output : {
4+ importMetaName : "pseudoImport.meta"
5+ } ,
6+ module : {
7+ parser : {
8+ javascript : {
9+ importMeta : false
10+ }
11+ }
12+ }
13+ } ;
You can’t perform that action at this time.
0 commit comments