0

Running this Meteor app is giving browser console error:

modules-runtime.js?hash=2b888cb…:155 Uncaught Error: Cannot find module '././lib'

//lib.js
let age = { // key.value pairs here };
let lib = { // key.value pairs here };
export {lib1, lib2}

//footer.js
import { lib, age } from '././lib.js'

enter image description here

Is there a problem with the import path?, if not, why the error? thx

Fred J.
  • 5,759
  • 10
  • 57
  • 106

2 Answers2

1

You import as "named import" which is why you need to export as named export:

//lib.js
export const age = { // key.value pairs here };
export const lib = { // key.value pairs here };

also your path is not checking for the "parent" folders (../) but current folder (./)

//footer.js
import { lib, age } from '../../lib.js'

See also: Javascript (ES6), export const vs export default

Community
  • 1
  • 1
Jankapunkt
  • 8,128
  • 4
  • 30
  • 59
0

it should be written like this ../lib.js or /client/templates/lib.js

Maxim Pokrovskii
  • 353
  • 4
  • 11