Remove '.js' from the imports
This commit is contained in:
@@ -155,7 +155,9 @@ ExampleBuilder.prototype.render = async function(dir, chunk) {
|
|||||||
if (!jsSource) {
|
if (!jsSource) {
|
||||||
throw new Error(`No .js source for ${jsName}`);
|
throw new Error(`No .js source for ${jsName}`);
|
||||||
}
|
}
|
||||||
|
// remove "../src/" prefix and ".js" to have the same import syntax as the documentation
|
||||||
jsSource = jsSource.replace(/'\.\.\/src\//g, '\'');
|
jsSource = jsSource.replace(/'\.\.\/src\//g, '\'');
|
||||||
|
jsSource = jsSource.replace(/\.js';/g, '\';');
|
||||||
if (data.cloak) {
|
if (data.cloak) {
|
||||||
for (const entry of data.cloak) {
|
for (const entry of data.cloak) {
|
||||||
jsSource = jsSource.replace(new RegExp(entry.key, 'g'), entry.value);
|
jsSource = jsSource.replace(new RegExp(entry.key, 'g'), entry.value);
|
||||||
|
|||||||
Reference in New Issue
Block a user