From 6f5ea7ba413d1b7e564a67b134695f7e12563f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 12 Nov 2020 19:41:52 +0100 Subject: [PATCH] Add dot import from node_modules test case --- .gitignore | 2 +- assets/js/main.js | 4 ++++ layouts/index.html | 1 + node_modules/mynodemod/index.js | 5 +++++ node_modules/mynodemod/lib/index.js | 3 +++ 5 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 node_modules/mynodemod/index.js create mode 100644 node_modules/mynodemod/lib/index.js diff --git a/.gitignore b/.gitignore index 996340a..ac6d483 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ public/ -node_modules/ +node_modules/date-fns/ assets/jsconfig.json \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js index 7ba537e..afa9ea1 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -12,10 +12,14 @@ import { hello4 } from './lib'; // From the Hugo template. import * as params from '@params'; +// https://github.com/gohugoio/hugo/issues/7948 +import { helloNodeModules } from 'mynodemod'; + window.hello1 = hello1; window.hello2 = hello2; window.hello3 = hello3; window.hello4 = hello4; window.hello6 = hello6; +window.helloNodeModules = helloNodeModules; window.data = data; window.params = params; diff --git a/layouts/index.html b/layouts/index.html index 19cd5a9..02771af 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -17,6 +17,7 @@
  • +
  • diff --git a/node_modules/mynodemod/index.js b/node_modules/mynodemod/index.js new file mode 100644 index 0000000..4d28a19 --- /dev/null +++ b/node_modules/mynodemod/index.js @@ -0,0 +1,5 @@ +import { helloFromNodeModules } from './lib'; + +export function helloNodeModules() { + return `Hello from node_modules: ${helloFromNodeModules()}`; +} diff --git a/node_modules/mynodemod/lib/index.js b/node_modules/mynodemod/lib/index.js new file mode 100644 index 0000000..f93a760 --- /dev/null +++ b/node_modules/mynodemod/lib/index.js @@ -0,0 +1,3 @@ +export function helloFromNodeModules() { + return 'Hello from lib in node_modules'; +}