Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed Jan 26, 2022
1 parent 57f6e3b commit 332fb11
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions lib/dependencies/ImportMetaPlugin.js
Expand Up @@ -105,27 +105,27 @@ class ImportMetaPlugin {
parser.hooks.expression
.for("import.meta.url")
.tap("ImportMetaPlugin", expr => {
const dep = new ConstDependency(
JSON.stringify(getUrl(parser.state.module)),
expr.range
);
dep.loc = expr.loc;
parser.state.module.addPresentationalDependency(dep);
if (options.url) {
const dep = new ConstDependency(
JSON.stringify(getUrl(parser.state.module)),
expr.range
);
dep.loc = expr.loc;
parser.state.module.addPresentationalDependency(dep);
}
return true;
});
parser.hooks.evaluateTypeof
.for("import.meta.url")
.tap("ImportMetaPlugin", evaluateToString("string"));

if (options.url) {
parser.hooks.evaluateIdentifier
.for("import.meta.url")
.tap("ImportMetaPlugin", expr => {
return new BasicEvaluatedExpression()
.setString(getUrl(parser.state.module))
.setRange(expr.range);
});
}
parser.hooks.evaluateIdentifier
.for("import.meta.url")
.tap("ImportMetaPlugin", expr => {
return new BasicEvaluatedExpression()
.setString(getUrl(parser.state.module))
.setRange(expr.range);
});
/// import.meta.webpack ///
const webpackVersion = parseInt(
require("../../package.json").version,
Expand Down

0 comments on commit 332fb11

Please sign in to comment.