academind/remix-practical-guide-course-resources

Can't get import statements to work using the tilde (~)

rstudner opened this issue · 0 comments

The path "/components/NewNote" is imported in app/routes/notes.jsx but "/components/NewNote" was not found in your node_modules. Did you forget to install it?
✘ [ERROR] Could not resolve "~/components/NewNote"

app/routes/notes.jsx:1:20:
  1 │ import NewNote from '~/components/NewNote';
    ╵                     ~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "~/components/NewNote" as external to exclude it from the bundle, which will remove this error.

I also noticed that your slides reference a remix.config.js that is different from the one here in github (but trying either doesn't change the error)

As well, the npx create-remix added:
// import { cssBundleHref } from "@remix-run/css-bundle";
and
// export const links = () => [
// ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
// ];

and I commented those out in favor of the course's method of doing links etc.