From 63de0aefbe38bf6a449d58d5a83bb70db8e939e1 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 27 Nov 2018 17:00:18 +0100 Subject: [PATCH] Remove '.js' from the imports --- examples/webpack/example-builder.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/webpack/example-builder.js b/examples/webpack/example-builder.js index 82eb7560ae..218b6d37d9 100644 --- a/examples/webpack/example-builder.js +++ b/examples/webpack/example-builder.js @@ -155,7 +155,9 @@ ExampleBuilder.prototype.render = async function(dir, chunk) { if (!jsSource) { 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(/\.js';/g, '\';'); if (data.cloak) { for (const entry of data.cloak) { jsSource = jsSource.replace(new RegExp(entry.key, 'g'), entry.value);