support import.meta in system transform
This commit is contained in:
@@ -87,6 +87,20 @@ export default declare((api, options) => {
|
||||
}
|
||||
},
|
||||
|
||||
MetaProperty(path, state) {
|
||||
if (
|
||||
path.node.meta.name === "import" &&
|
||||
path.node.property.name === "meta"
|
||||
) {
|
||||
path.replaceWith(
|
||||
t.memberExpression(
|
||||
t.identifier(state.contextIdent),
|
||||
t.identifier("meta"),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
ReferencedIdentifier(path, state) {
|
||||
if (
|
||||
path.node.name == "__moduleName" &&
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
console.log(import.meta.url);
|
||||
@@ -0,0 +1,10 @@
|
||||
System.register([], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
console.log(_context.meta.url);
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "syntax-dynamic-import", "transform-modules-systemjs"]
|
||||
"plugins": ["external-helpers", "syntax-dynamic-import", "syntax-import-meta", "transform-modules-systemjs"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user