Allow defining the moduleIds-related option in the transform p… (#11194)
* Update "moduleIds" tests * Allow defining the moduleIds related options in the transform plugins - moduleIds - moduleId - getModuleId - moduleRoot * Sort deps
This commit is contained in:
@@ -2,7 +2,7 @@ import { declare } from "@babel/helper-plugin-utils";
|
||||
import hoistVariables from "@babel/helper-hoist-variables";
|
||||
import { template, types as t } from "@babel/core";
|
||||
import { getImportSource } from "babel-plugin-dynamic-import-node/utils";
|
||||
import { rewriteThis } from "@babel/helper-module-transforms";
|
||||
import { rewriteThis, getModuleName } from "@babel/helper-module-transforms";
|
||||
|
||||
const buildTemplate = template(`
|
||||
SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {
|
||||
@@ -501,7 +501,7 @@ export default declare((api, options) => {
|
||||
);
|
||||
});
|
||||
|
||||
let moduleName = this.getModuleName();
|
||||
let moduleName = getModuleName(this.file.opts, options);
|
||||
if (moduleName) moduleName = t.stringLiteral(moduleName);
|
||||
|
||||
hoistVariables(
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"moduleIds": true,
|
||||
"moduleId": "my custom module name"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
System.register("my custom module name", [], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
"moduleIds": true,
|
||||
"moduleId": "my custom module name"
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
["transform-modules-systemjs", {
|
||||
"moduleIds": true,
|
||||
"moduleId": "my custom module name"
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user