diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | assets/js/main.js | 4 | ||||
-rw-r--r-- | layouts/index.html | 1 | ||||
-rw-r--r-- | node_modules/mynodemod/index.js | 5 | ||||
-rw-r--r-- | node_modules/mynodemod/lib/index.js | 3 |
5 files changed, 14 insertions, 1 deletions
@@ -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 @@ <li x-text="hello3()"></li> <li x-text="hello4()"></li> <li x-text="hello6()"></li> + <li x-text="helloNodeModules()"></li> <li x-text="data.Hugo"></li> <li x-text="params.myparam"></li> </ul> 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'; +} |