From 741c0c31fe779c8527da1514ee6331c53aec3b9b Mon Sep 17 00:00:00 2001 From: Alessandro Pagiaro Date: Tue, 7 Apr 2020 10:45:20 +0200 Subject: [PATCH 1/3] Import default --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 47c884a..4dad8aa 100644 --- a/index.js +++ b/index.js @@ -15,7 +15,7 @@ function replaceStringsWithRequires(string, relativeTo) { url = "./" + url; } if (os.platform() === "win32") url = url.replace(/\\/g, '\\\\'); - return "require('" + url + "')"; + return "require('" + url + "').default"; }); } From cac6b85c043f3cb01502b114a030b4de0e718072 Mon Sep 17 00:00:00 2001 From: Alessandro Pagiaro Date: Tue, 7 Apr 2020 11:01:09 +0200 Subject: [PATCH 2/3] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b227c1..08e71ff 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ Webpack loader that inlines all html for AngularJS code that specifies a `templa - [How does it work](#how-does-it-work) - [Common Issues](#common-issues) +### This Fork +Since we are using raw-loader, it returns an object with the default properties to be compatible with ES6 standard. This tool uses ES5 syntax so we need to access to default value explicitly. Another possible solution is to upgrade raw-loader to 4.0.0 and use `esModules: false` properties but our build tool chain uses a node version not supported by raw-loader 4.x. + ### Installation Option 1: Install from [npm](https://www.npmjs.com/package/angularjs-template-loader). - `npm install angularjs-template-loader --save-dev` @@ -71,7 +74,7 @@ angular.module("my-module").component("my-component", { #### After (before it is bundled into your webpack'd application) ```js angular.module("my-module").component("my-component", { - template: require('/root/some/path/app/src/myComponent.html" , + template: require('/root/some/path/app/src/myComponent.html").default, controller: "MyController" }); ``` From 19f0ab324decf5497b1dbc098738a0de5ab6ea3f Mon Sep 17 00:00:00 2001 From: Alessandro Pagiaro Date: Tue, 7 Apr 2020 11:01:39 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 08e71ff..7ecf092 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,6 @@ Webpack loader that inlines all html for AngularJS code that specifies a `templa - [How does it work](#how-does-it-work) - [Common Issues](#common-issues) -### This Fork -Since we are using raw-loader, it returns an object with the default properties to be compatible with ES6 standard. This tool uses ES5 syntax so we need to access to default value explicitly. Another possible solution is to upgrade raw-loader to 4.0.0 and use `esModules: false` properties but our build tool chain uses a node version not supported by raw-loader 4.x. - ### Installation Option 1: Install from [npm](https://www.npmjs.com/package/angularjs-template-loader). - `npm install angularjs-template-loader --save-dev`