CodeNewbie Community 🌱

Abdulrahman Noble
Abdulrahman Noble

Posted on

Webpack can't recognize modules

Good day! I've got errors Uncaught TypeError: setting getter-only property "todo" and Uncaught TypeError: lib is undefined. My assumption is that those errors appear when I created a new module for local storage API.
I moved specific functions of local storage to that module.
When the whole code stored in the global scope, app functions fine without issues. The syntax for named export/import is correct.

The code from storage module:

export let todo = JSON.parse(localStorage.getItem("todo-list"));

export function setLocalStorage() {
    localStorage.setItem("todo-list", JSON.stringify(todo));
  }

Enter fullscreen mode Exit fullscreen mode

How it's imported:

import { todo, setLocalStorage } from "./modules/storageModule";
Enter fullscreen mode Exit fullscreen mode

You can check my repository here

Top comments (2)

Collapse
 
jackiee32 profile image
Info Comment hidden by post author - thread only accessible via permalink
Rana Arham

ApkTodoDesbloqueado is the ideal site for mod apks that offer you everything unlocked in your favorite games . Enjoy enhanced gaming experiences with fast and direct downloads from our vast collection of game mods.

Collapse
 
jemm732 profile image
Jemm732

Sometimes these errors may appear but can be easily soved.

Some comments have been hidden by the post's author - find out more